Fixes #8048: n+1 query selecting multiple hosts

Sample data for 200 hosts selected, organizations and locations enabled.

* Click on change environments takes ~9-10s to load on my hardware without eager loading
* With the patch it's reduced to ~3-4s (around a 66% speedup for the query)