There should be a service that allows retrieving Statements with a certain property id from a given entity.
Initially this can be implemented on top of an EntityLookup. Later on this implementation can be interchanged for a caching or otherwise more efficient implementation.
This can be used for Lua lookups (for [[https://www.mediawiki.org/wiki/Extension:Wikibase_Client/Lua#mw.wikibase.getBestStatements|mw.wikibase.getBestStatements]] and [[https://www.mediawiki.org/wiki/Extension:Wikibase_Client/Lua#mw.wikibase.getAllStatements|mw.wikibase.getAllStatements]]), for the commons category sidebar link, for T179155: Find a better solution for dewiki's Modul:Wikidata isParent and probably in many more places.