perf(entities): loads more entities with a single query

This optimizes elgg_get_entities() to automatically add joins to load entities
in fewer queries. It also improves get_entity() by using elgg_get_entities
internally.

Fixes #7662, #7659
FYI I got rid of memcache here because it added complexity with likely no gain, since you had to test with a query anyway, *and* load the metadata.