I did some testing on how the game decides what ceiling triangle Mario is under.
The result (pictured above) is that it breaks the triangle's down into whole units. In the above picture X is vertical and Y is horizontal, sorry for lack of convention. Anyway solid lines mean that edge is included for mario being under the ceiling tile, and dashed lines mean that edge is not included. At exterior corners, Mario is outside, at interior corners he is inside.
This seam does happen exactly where Mario lands in the video, so I imagine it must be involved somehow.
But this isn't the whole story. It turns out that if I just put Mario under one or the other tiles using MHS, the game updates the tile the next frame. However when Mario is moving, what tile he is under actually lags behind a frame.
As it happens, Mario's speed is extremely small after hitting the wall just before landing. Maybe the combination of all these factors is enough to get an edge case where the game is confused about what tile Mario is under and as a last resort to resolve the conflict ejects him.