I wonder if it's detecting a magnet at the front edge from the closed lid of the notebook underneath, telling the system on top that the lid is closed?
The sensor that recognizes if the laptop is closed sits on the left, next to the audio jack. If you get a magnet within 2-3 cm of it, it triggers and the screen turns off. Seems like the magnet in the lid of the other laptop is just close enough.
Seems to me that it is likely due to the magnets on the hinge of the bottom laptop connecting with the bottom part of the top laptop. The top laptop then treats it as if the lid is closed.
This is not just a framework thing. Have you ever wondered how a laptop knows that the lid is closed? Its magnets. The laptop has a magnet triggered switch in it that turns off the screen when the lid is closed. When you stack them you put the top laptop in range of the bottoms magnet triggering the reed switch in the top laptop turning off the screen.
🧲, my Samsung tablet does the same thing when flipping the magnetic lid around the back. The screen shuts off and it's annoying and it's the official cover.