Just to elaborate on what Michael means, basically the animals "see" the world as a flat plane, so as they wander around the world objects that are on or just below the same plane as them register as an obstruction, while objects above it are ignored.
An example is building a dirt wall around your tribe and then adding a wall on top of it, that will stop most players from getting inside, but a bear wont register the wall as being there and will climb up and over the dirt pile.
Similar issue with terraforming a flat area on a decent slope, you are going to have a dirt bank where you have had to build up the ground level, animals can't "see" what's on top of the bank and will just walk up the bank into your tribe. This one give the animals a problem, because once they are inside your tribe they are at the same level as your buildings, and are stuck as they can't "see" a way out.
There is an "issue" with gates, dismantling one means that any walls touching it, above, below or to the sides, no longer register as being there to animals. Dismantling the "bugged" walls doesn't help as the bug gets passed onto any walls touching them, basically you are looking at a total dismantle and rebuild of most of the external walls and gates in your tribe.
Even a simple internal redesign of your tribe can break the external walls, on War I had two "cabins", each was in a corner of the tribe, removing them resulted in me having to dismantle and redesign roughly 80% of the exterior walls, only the area at the front gate didn't need to be touched.
On Peace I have Scrapper Corrugated walls around the outside, they stop animals from getting in or out, they also don't touch the main walls in any way that they can catch the bug, which is just as well as the inside around my animal enclosure is a mass of bugged walls.