In 1.14.3 survival, I have an underground iron golem farm at bedrock level which transports naturally spawned golems to the surface. After freeing about 30 of them, they all seem to wander off in a specific direction. I made some staircases for them, and they end up congregating on top of a nearby mountain. There are no villages nearby in that direction. Why do they want to climb this particular mountain? Is there something I'm missing?
Perhaps a path finding bug. Are you sure each golem kept to the same exact direction like a slime? If you don't want them to leave, maybe use a lead and tie them to a fence, so you can use them as a guard. 1.14.3 has a few minor bugs. A new 1.14.4 just got released. Try that.