Entites can escape within a 2-block high area
When I was playing a custom map and relogged in a 2-block high space, I got onto the top of it. This also applys when a villager stands on a chest in a 3-block high room and if you relog, they got teleported onto the roof.
Steps to reproduce (not 100% accurate)
1. Spawn a mob in a 2-block high closed area or stand in a 2-block high closed area
2. Relog
3. You may find yourself or the mob being teleported on a roof