This is my little take on stone walls which I've built plenty of over the decades...
Stone walls have been going up since people decided to stay in one place and needed to keep livestock from wandering away. Mostly the stone would be picked up from close by and set on top of a firm base and built up high enough to keep the animals in.
When walls became higher and heavier they would then have to be built on stronger foundations which meant digging down to hard ground. When houses began to be built out of stone the foundations had to go much deeper and ways had to be found to support the huge weight of the building.
Cathedrals are massive in weight and have very hard foundations, the weight of the stone also would push the foundation down more, and they must have done it right as most cathedrals are still standing.
It is only recently that concrete has been used as a foundation but the best foundation is to build on rock.
Sometimes they got it wrong though and you can see the building leaning, as in the leaning tower of Pisa in Italy which I went up to the top of once and looked down; amazing.
So you see, sometimes the most beautiful buildings are not always straight and perfect.
Image from Pixabay