I haven't looked into it in detail but here's some fact and some conjecture:
When Jumpman climbs ladders, he moves in 2 pixel jumps when he goes up or down.
To dismount a ladder, Jumpman has to be at the exact height of either of it's ends.
Ladders are always a length of an even number of pixels so this works out normally.
The retractable ladder on the Pies stage is able to pull Jumpman down 1 pixel at a time.
But the code stops pulling him down past a certain Y coordinate so this also still works out normally.
But there is some glitch when you rapidly switch between pushing up and down while climbing a ladder...
...Or perhaps simply pushing up, or maybe down, at a specific time, such that...
...the retractable ladder pulls Jumpman to an odd Y coordinate, but a joystick input also moves Jumpman so that he exits from the retracting ladder while still at an odd Y coordinate (which would normally pull him down one additional pixel).
Once Jumpman is climbing a ladder at some odd pixel step, he will no longer be able to dismount the ladder because his coordinate will not line up with the 'dismount' coordinates (since he climbs in 2 pixel steps).
So now he can climb out of range above or below the actual ladder.