The occlusion test above should work.
In Edit -> Preferences -> General -> Procedural Runtime, what is the value for Maximum distance for occlusion? If this is 0, then overlaps() will return true (due to numerical imprecision) because the floors are touching the neighboring floors (above and below) that were created in the split. This value is by default 0.001. So, if this value is zero, this might be a reason why the floors are red even when they are not touching the lower building. (Note: You can also add the keyword inter to your occlusion tests to only test between objects in the scene and not within objects. This is faster than using the keyword "all".)
What is the rule FloorEnvelope doing? I tested the code with FloorEnvelope as a terminal shape, and this seems to work for me. In this rule, are other shapes being created that might interfere with the occlusion testing? Is there a comp split? comp splits create ghost shapes that are used in occlusion testing.
As a note, if shapes are generated, then occlusion testing should work between them. You should not need to reopen the scene if you move your query object. If you change the cga code of the occluder object without regenerating, then you might get some unexpected results.
Would you be willing to post your scene and code? I'm not really sure why it's not working.