Problem/Motivation
>3 years ago, #2557815: Automatically bubble the "user.node_grants:$op" cache context in node_query_node_access_alter() introduced automatic cacheability bubbling for node_query_node_access_alter()
. But ideally, this wouldn't need to bubble (onto the currently active render context if any) at all, ideally this cacheability would just be associated with the query itself.
We encountered this in the API-First initiative too, in #3005826: Follow-up for #2984964: JSON API + hook_node_grants() implementations: count queries still result in cacheability metadata leak.