The bug
I've found a problem with removing villagers (tested with cows, zombies and creepers) from mine carts, when they leave the cart they end up outside the area I wanted (1x1x2) and escape (it is repeating).
How to reproduce
Dig a 2-block-deep 1x1 hole
Dig an identical hole one block diagonally away from the first hole
Stand in the first hole and run the following command:
/summon minecart ~ ~ ~ {Passengers:[{id:villager}]}
Destroy the minecart
→ ❌ The villager is ejected into the second hole
Expected result
The villager should remain in the first hole.
Thanks for fixing this up a little (a lot actually), I've never done one 😅