I can think of two alternatives, and a third option if you still have 1-2 months time.
First, maybe adjusting your query would work, so that you match the triangle centroids to the 2D roof surfaces (eg. with ST_Within), instead of matching the triangle themselves. I’ve never tried this though.
If the first alternative doesn’t work, then I’m afraid its your Plan B. You could group the triangles based on the orientation of their normal vector. Postgis doesn’t have a function for this as far as I know, so you would need to write one yourself. Or do the computation outside the DB, but that required offloading the data.
Lastly, the upcoming 3D BAG update (in 1-2 months) won’t have triangulated 3D surfaces anymore, so this problem will disappear. This is the least-effort option, but it will take some time.