They're basically just invisible fences, though. The same problem seems to occur!I use Paving Stones of Warding for my enclosures.
Fences, walls, and other partial-sized blocks are definitely unreliable for keeping animals in. I'd go with an enclosure of glass blocks two high or glass/cobble full blocks with a half-slab on top, so if the animals are pushed into them they won't suffocate.