I think the issue is from the time a creature is taken out of the cage, and pitted into the hatch covered pit.
At which point, the creature is falling, and has a chance to grab hold of the "wall immediately below the pit" that is covered by a hatch.
This behavior of chance to grab hold of the wall is part of the climbing feature. And if the creature is successful in grabbing hold of the wall, then it can proceed to climb out.
One way to address the "grab hold" of the wall, is to make that wall unclimb-able:
One way is to channel the pit opening, and smooth the natural stone to make it impossible to climb as well as impossible to "grab hold"
The second way is to not have a wall z-1 of the pit, so a hole of the floor is not something that can be "grab hold".
The other possible issue is the "time it takes to take out the caged creature and pitting", has a possibility the dwarf becomes interrupted.
Interrupted by being hungry, thirsty maybe, or need to socialize?
Or being spooked by other creatures dwarfs nearby who are also in the process of being pitted.
I've done this once, where I am pitting 1 creature zombie at a time, and there were no escaped / spooked.
But when I pitted around 6, some zombies escaped and cause mayhem.