I'm not an android dev so I'm not positive about this but I expect whatsapp is shipping their app with "App Actions" interface giving the assisstant certain actions it can perform, so this is not wholesale database access. See [0]
App Actions extend your in-app functionality to Assistant, enabling users to access your app's features by voice. When a user invokes an App Action, Assistant matches the query to a BII declared in your shortcuts.xml resource, launching your app at the requested screen or displaying an Android widget.
You declare BIIs in your app using Android capability elements. When you upload your app using the Google Play console, Google registers the capabilities declared in your app and makes them available for users to access from Assistant.
https://developer.android.com/develop/devices/assistant/over...
https://developer.android.com/guide/topics/ui/accessibility/...
>Devices running Android 8.0 (API level 26) and higher include several text-processing features that make it easier for accessibility services to identify and operate on specific units of text that appear on screen.