I've found that increasing megabeasts and caves has almost no effect.
During several overzealous world-gens, I used a medium region world with 40 civs and 800 megabeasts and just as many semi-megabeasts (with caves) and they STILL all died out by year 70.
your problem would be the 40 civs, megabeasts compete with civs for space so a lower amount of civs should enable megabeasts to survive longer as it takes longer for civs to cover the map in settlements.
*EDIT* As a proof of concept i made a quick alteration of garden of gaia. I limited the number of civs to 10 and had about 800 mega/semi megabeast caves. Hit age of legends at year 243, stopped generation at 250. All of the civs survived except the automatons that died in year 27, no frost giants appeared as there were not enough civs to have one for every race as i forgot to disable ashlander elves.
Summary: there are over a hundred dragons, 91 titans, over 60 metal colossi of various kinds, 35 roc, about 300 giants and various other mega/semimegas still alive. There are also huge numbers of liches, vampire lords and various other nasties around. There are 708 lairs on the map, 516 fortresses, 262 shrines,14 tombs and 4 towers.
The ashlander elves are ruled by a dwarf
The gnomes are ruled by a sky giant
The goblins are ruled by a lich (Reminds me of the order of the stick webcomic)
The orcs are ruled by an elf
The warlocks are ruled by a cursed blacksmith