Ziggurats: Homes of the gods

Ziggurat
Ziggurats or Pyramids are ancient structures, many made with extremely large stones. Their construction has baffled archeologists as to how the primitive technologies could have handled such an undertaking. According to Herodotus, at the top of each ziggurat was a shrine, although none of these shrines has survived. One practical function of the ziggurats was a high place on which the priests could escape rising water that annually inundated lowlands and occasionally flooded for hundreds of miles. Another practical function of the ziggurat was for security. Since the shrine was accessible only by way of three stairways, a small number of guards could prevent non-priests from spying on the rituals at the shrine on top of the ziggurat. From archaeological evidence, historians surmise that the Sumerians and Babylonians viewed ziggurats as homes of the gods, and access to them appears to have been restricted to priests and other religious officials. Similar ziggurats can be found in ancient Mesoamerica as well. How did these 2 completely disconnected cultures build such similar structures? There must be a common root for both.