The entire solar system formed when a molecular cloud was hit by a shockwave of a supernova. So all the molecules of our solar system formed at that same moment. The sun and all the protoplanets actually started accreting at the same time. But it took the sun some time before it reached the pressure required to start the fusion. So there was some time when the protoplanets were accreting but the sun had not given sunlight yet.
This indicates that one or more supernovae must have occurred near the location where the Sun formed. A shock wave from a nearby supernova would have triggered the formation of the Sun by compressing the matter within the molecular cloud and causing certain regions to collapse under their own gravity. As one fragment of the cloud collapsed it also began to rotate because of conservation of angular momentum and heat up with the increasing pressure. Much of the mass became concentrated in the center, whereas the rest flattened out into a disk that would become the planets and other Solar System bodies. Gravity and pressure within the core of the cloud generated a lot of heat as it accreted more matter from the surrounding disk, eventually triggering nuclear fusion. Thus, the Sun was born.
Wikipedia, Sun, 2018
So there was some time when the solar system was accreting but still the sun had not started fusion yet. This was only known recently, however 1400 years ago the Quran said that it was all darkness with no sunlight; the sun only shone later.
[Quran 17.12] We have made the night and the day two wonders. We erased the wonder of the night, and made the wonder of the day revealing, that you may seek bounty from your Lord, and know the number of years, and the calculation. We have explained all things in detail.

“We erased the wonder of the night” it was all night (no sunlight) until later when sun shone. Notice the Quran didn’t mention Earth or any other planet because it wasn’t a planet yet. Today we know that this is correct. No mistakes in the Quran.