Masonry is one of the oldest building crafts in the world. The construction of Egyptian pyramids, Roman aqueducts, and medieval cathedrals are all examples of masonry. Early structures used the weight of the masonry itself to stabilize the structure against lateral movements. The types and techniques of masonry used evolved with architectural needs and cultural norms.
AskHistorians
I recall watching a Mary Beard documentary about multistory housing in Rome on YouTube. She showed basically a 4 story apartment building made of brick. Thick walls, small rooms, no windows, arches. The richer folks lived on the ground floor iirc.
Yeah I think it was pretty universal that the rich lived on the lower floors till elevators and air conditioning got decent.
Though the middle income folks lived on upper floors as the then standard in many places for getting rid of waste was to throw it out the window.
They had smart folk that understood structural engineering. Kings hired the smart architect / engineer types to build castles on sides of mountains etc. While school is formalized and standardized now, people just as smart existed back then and understood beams, cantilevers, flying buttresses, arches etc