The sun energy source is not fusion. The sun and other stars are heated by magnetic fields from the supermassive black hole at the center of the Milky Way galaxy.
With this idea it is possible to trace the formation of the solar system. The sun and planets formed separately. First the sun formed and then after some time the planets formed. Red giants are not dying stars. Stars fluctuate all the time from being a red giant to being a regular star. The sun was a red giant 4.6 billion years ago as evident from meteorite age. The solar planets formed from the strong solar wind of the red giant sun. There are two facts that support this idea. One is the presence of chondrules in many meteorites and the second is the presence of short lived isotopes in meteorites and comets. Observations of red giant stars show that they eject large amount of material and dust. This material resemble in composition to the material in the solar system.
For more details read the article:
How the solar system formed, is a puzzle that challenged scientists for many centuries. The current accepted theory is the Solar Nebula Hypothesis originated by Kant and Laplace in the 18th century. In reference 1 it was suggested that the sun energy source is not fusion but magnetic fields from the center of the galaxy. The Solar nebula Hypothesis cannot coexist with a sun powered by magnetic fields. As shown on reference 4, those magnetic fields create mass that slowly increase the mass of the sun. The sun is growing not from dust from the interstellar space but from synthesis of new particles in the sun interior. The sun and the planets formed separately, the sun came first and then the planets follow.
In the standard solar model stars are turned into red giants when the hydrogen in their core is depleted and the energy production stop. Stars do not work on fusion, but on magnetic fields, so they turn into a red giant when their energy supply from the magnetic field is stopped. Stars that have a very long Maunder minimum, for tens of million of years, in which their stellar cycle is weak, will turn into a red giant.
The exoplanet search programs found that stars with planets have higher metallicity compared to stars without planets. The metallicity of a star depends on its mass. Massive stars have higher pressure and temperature in their core that increase the fusion rate of heavy elements. Stars with planet, that show higher metallicity, had higher mass in the past that created the high metallicity. They went through a significant mass loss that decreased their mass but did not change the high metallicity. Those stars significant mass loss occur when they turned into red giants. Red giants have strong stellar wind that disperses the star outer layers into interstellar space. This stellar wind creates comets that form planets around the star. The high metallicity of the sun indicates that it was a red giant. The solar planets where born from the solar wind of the red giant sun. The solar system shows many evidences in support of an ancient red giant sun.
The energy calculation in reference 4 suggests that stars are slowly growing by converting the energy from the magnetic fields to mass. The gradual mass increase indicates that more massive stars are also older, so according to the standard solar model there is a mix up between older and younger stars. Older stars are not the smaller stars like red dwarfs but the heavier stars like blue giants. The idea that stars are slowly growing from small sizes, and the fact that the latest exoplanet search programs found large number of exoplanets, leads to the conclusion that stars originate from planets. The development steps leading to the creation of stars from planets include: growth of the planet by cold accretion of comets and asteroids; separation of the planet from the star; magnetic ignition of the planet when it reaches the size of a brown dwarf; and growth of the star by conversion of the energy from the magnetic fields to mass.