Animals always tend to wander uphill due to a quirk in how random wandering positions are chosen:
Positions which don't have a solid block under them are discounted, but positions inside the ground are not discounted and instead raised to the surface. This causes a very heavy bias for animals to naturally wander up hills, and causes behaviour like in the attached image.
Linked issues
relates to 1
Attachments
Comments 2
I can confirm this is in vanilla minecraft as well, it is rather hard to screenshot as it's ultimately still just a bias to move upwards and not guaranteed, however I can point to this video (timestamped) https://youtu.be/jpi50LX2Qyk?t=98 demonstrating it on a larger scale and I have also made a mod which can be viewed here https://github.com/Favouriteless/StupidCowStopClimbing which fixes this behaviour without breaking player mob farms which rely on pathfinding, however the method I used to do so most likely isn't the most performant.
The best way I can explain the bug is that when a random position is chosen, if that position has a solid block under it, then that position will be moved upwards until a solid block with air above it is found, and the animal will path towards that. However, if a block in the air without a solid block under it is chosen, it will not be moved downwards. This makes columns which contain a higher pillar of blocks far more likely to be chosen than lower columns which mostly contain air.
The modding environments we use are remapped so I'm not sure how useful this will be, but the problem occurs in LandRandomPos#generateRandomPosTowardDirection(PathfinderMob, int, boolean, BlockPos), as far as I know the class name and method signature should be about the same.
Please verify if this is the case in vanilla, as your report shows a modded setup.
If you can reproduce this in vanilla, provide a screenshot with the F3 debug menu enabled.