LPS-46779 Improved query: get the mapped objects from the first query instead of getting userIds first and then iterate to get mapped objects

Hey Brian!

I reviewed what you said in https://github.com/brianchandotcom/liferay-portal/pull/18592.
Two things to mention

  - We can't use brackets in custom select because that way, all queries must use the Hibernate query with entity, but not with scalar. If you check countByC_FN_MN_LN_SN_EA_S method, it uses the same query but with an scalar (userId) instead of an entity (UserImpl)

  - I reviewed my SQLQueryImpl change and it's not needed anymore, so I reverted it. I thought union queries couldn't use table aliases but it seems they can.

Thanks!