Hq dropdowns

Implements https://docs.google.com/a/dimagi.com/document/d/1GtVw-_Wq7aRyFCY0ervt6Q8nQNsJde5R_zZXFXAfr-Q/edit?disco=AAAAAQ_ZnoE

More than half of the commits are about performance though. The main navigational-menu loading time increases by ~0.140 seconds from around 0.09 seconds to 0.23 seconds. 

@czue @snopoke - the number of calls to various db-level queries (Domain.get_by_name) is reduced to 2 from around 37. 
F401 'PermissionDenied' imported but unused