Hah, did some extensive digging and found something that will help:
bool libNtve_gf_UnitIsVisibleToPlayer (unit lp_unit, int lp_player) {
// Implementation
return UnitFilterMatch(lp_unit, lp_player, UnitFilter((1 << c_targetFilterVisible), 0, 0, 0));
}
This function exists in NativeLib.galaxy. Apparently the UnitFilter tag "Visible" is based on the fog of war.
So now I can tell which building has been "spotted" without having to check the sight range of every unit the AI controls.