See for instance this sutta (DN 27) somewhere in the middle
There comes a time when, Vāseṭṭha, after a very long period has
passed, this cosmos contracts. As the cosmos contracts, sentient
beings are mostly headed for the realm of streaming radiance. There
they are mind-made, feeding on rapture, self-luminous, moving through
the sky, steadily glorious, and they remain like that for a very long
time.
There comes a time when, after a very long period has passed, this
cosmos expands. As the cosmos expands, sentient beings mostly pass
away from that group of radiant deities and come back to this realm.
Here they are mind-made, feeding on rapture, self-luminous, moving
through the sky, steadily glorious, and they remain like that for a
very long time.
So for me this means this is repeating with no discernable beginning nor discernable end. The discurse becomes then more to the details:
- Solid Nectar Appears
But the single mass of water at that time was utterly dark. The moon
and sun were not found, nor were stars and constellations, day and
night, months and fortnights, years and seasons, or male and female.
Beings were simply known as ‘beings’. After a very long period had
passed, solid nectar curdled in the water. It appeared just like the
curd on top of hot milk as it cools. It was beautiful, fragrant, and
delicious, like ghee or butter. And it was as sweet as pure manuka
honey. Now, one of those beings was reckless. Thinking, ‘Oh my, what
might this be?’ they tasted the solid nectar with their finger. They
enjoyed it, and craving was born in them. And other beings, following
that being’s example, tasted solid nectar with their fingers. They too
enjoyed it, and craving was born in them.
and so on, comparable to old egytian, sumerian and what you want legends. Just read the full sutta, I find it very interesting.