In one campaign I ran, a thousand years before , Dragons were a much greater threat and so there were lots of underground fortresses and cities. The dragons were defeated by a mythic hero and over time, those fortresses and cities became classic dungeons as monsters, bandits, crazy wizards...