That's not how things work.
The Mayans were a civilization based on water control. Water is necessary to survive and was only available seasonally in the region the Mayans originate from. The Mayan kings developed ways to control water, which in turn got them the following of their subjects, which allowed them to have a massive workforce available to build more sophisticated ways to control water, as well as the incentive to develop the technology further to stay in power.
Something similar happened to all ancient civilizations; they get developed out of need, dependence on a ruling class is built to address that need, and massive constructions are the result of large populations being controlled and conditioned.
Why is there no such thing during the middle ages? Because to a degree, people were generally happy, had what they needed and were left to their own devices instead of being at the mercy of a control freak.