It's clearly something they imagined, because looking at the details, they are all off in a way that implies a complete lack of understanding of the scales involved.
For example, according to the Encyclopedia Britannica
Puranic cosmogony accounts for the periodic destruction of the world at the close of an eon, when the Fire of Time will put an end to the universe.
and a definition of an eon is
Puranic myths developed around the notion of yuga (world age), of which there are four. These four yugas, Krita, Treta, Dvapara, and Kali—they are named after the four throws, from best to worst, in a dice game—constitute a mahayuga (large yuga) and, like the comparable ages of the world depicted by the Greek poet Hesiod, are periods of increasing deterioration. Time itself also deteriorates, for the ages are successively shorter. Each yuga is preceded by an intermediate “dawn” and “dusk.” The Krita Yuga lasts 4,000 years, with a dawn and dusk of 400 years each, for a total of 4,800 years; Treta a total of 3,600 years; Dvapara 2,400 years; and Kali (the current one), 1,200 years. A mahayuga thus lasts 12,000 years and observes the usual coefficient of 12, derived from the 12-month year, the unit of creation. These years are “years of the gods,” each lasting 360 human years, 360 being the days in a year. One thousand mahayugas form one kalpa (eon), which is itself but one day in the life of Brahma, whose life lasts 100 years; the present is the midpoint of his life. Each kalpa is followed by an equally long period of abeyance (pralaya), in which the universe is asleep. Seemingly, the universe will come to an end at the end of Brahma’s life, but Brahmas too are innumerable, and a new universe is reborn with each new Brahma.
In other words, a eon is 12,000×360×1000=4.23 billion years. We know that the Sun is already older than that and that it will last for 4 billion more years when the expansion will start, and will end in 4 more billion years.
Also, the Purana predicts 7 rays which become 7 suns which will burn the three worlds (heaven, normal world and netherworld). All of this is inconsistent with a Red Giant expansion, which is slow, singular and probably much hotter than imagined by the author of the Purana.
This is the orignal translated passage in the Vishnu Purana
PARAS'ARA.--A Pararddha, Maitreya, is that number which occurs in the eighteenth place of figures, enumerated according to the rule of decimal notation. At the end of twice that period elemental dissolution occurs, when all the discrete products of nature are withdrawn into their indiscrete source. The shortest period of time is a Matra, which is equal to the twinkling of the human eye. Fifteen Matras make a Kashtha; thirty Kashthas, one Kala; fifteen Kalas, one Nadika. A Nadika is ascertained by a measure of water, with a vessel made of twelve Palas and a half of copper, in the bottom of which there is to be a hole made with a tube of gold, of the weight of four Mashas, and four inches long. According to the Magadha measure, the vessel should hold a Prastha (or sixteen Palas) of water. Two of these Nadis make one Muhurtta; thirty of which are one day and night. Thirty such periods form a month; twelve months make a year, or a day and night of the gods; and three hundred and sixty such days constitute a year of the celestials. An aggregate of four ages contains twelve thousand divine years; and a thousand periods of four ages complete a day of Brahma. That period is also termed a Kalpa, during which fourteen Manus preside; and at the end of it occurs the incidental or Brahma dissolution. The nature of this dissolution is very fearful: hear me describe it, as well as that which takes place at the elemental dissolution, which I will also relate to you.
At the end of a thousand periods of four ages the earth is for the most part exhausted. A total dearth then ensues, which lasts a hundred years; and, in consequence of the failure of food, all beings become languid and exanimate, and at last entirely perish. The eternal Vishnu then assumes the character of Rudra, the destroyer, and descends to reunite all his creatures with himself. He enters into the seven rays of the sun, drinks up all the waters of the globe, and causes all moisture whatever, in living bodies or in the soil, to evaporate; thus drying up the whole earth. The seas, the rivers, the mountain torrents, and springs, are all exhaled; and so are all the waters of Patala, the regions below the earth. Thus fed, through his intervention, with abundant moisture, the seven solar rays dilate to seven suns, whose radiance glows above, below, and on every side, and sets the three worlds and Patala on fire. The three worlds, consumed by these suns, become rugged and deformed throughout the whole extent of their mountains, rivers, and seas; and the earth, bare of verdure, and destitute of moisture, alone remains, resembling in appearance the back of a tortoise. The destroyer of all things, Hari, in the form of Rudra, who is the flame of time, becomes the scorching breath of the serpent S'esha, and thereby reduces Patala to ashes. The great fire, when it has burnt all the divisions of Patala, proceeds to the earth, and consumes it also. A vast whirlpool of eddying flame then spreads to the region of the atmosphere, and the sphere of the gods, and wraps them in ruin. The three spheres shew like a frying-pan amidst the surrounding flames, that prey upon all moveable or stationary things. The inhabitants of the two upper spheres, having discharged their functions, and being annoyed by the heat, remove to the sphere above, or Maharloka. When that becomes heated, its tenants, who after the full period of their stay are desirous of ascending to higher regions, depart for the Janaloka.
Janarddana, in the person of Rudra, having consumed the whole world, breathes forth heavy clouds; and those called Samvartta, resembling vast elephants in bulk, overspread the sky, roaring, and darting lightnings. Some are as black as the blue lotus; some are white as the water-lily; some are dusky, like smoke; and some are yellow; some are of a dun colour, like that of an ass; some like ashes sprinkled on the forehead; some are deep blue, as the lapis lazuli; some azure, like the sapphire; some are white, as the conch or the jasmine; and some are black, as collyrium; some are of bright red, like the ladybird; some are of the fierceness of red arsenic; and some are like the wing of the painted jay. Such are these massy clouds in hue: in form some resemble towns, some mountains, some are like houses and hovels, and some are like columns. Mighty in size, and loud in thunder, they fill all space. Showering down torrents of water, these clouds quench the dreadful fires which involve the three worlds, and then they rain uninterruptedly for a hundred years, and deluge the whole world. Pouring down in drops as large as dice, these rains overspread the earth, and fill the middle region, and inundate heaven. The world is now enveloped in darkness, and all things, animate or inanimate, having perished, the clouds continue to pour down their waters for more than a hundred years.
All in all, there's a similarity, but not a perfect match - so it seems to be a form of retroactive clairvoyance.