Chicken or the egg?!
Is it not obvious the sun came after the earth?
People like to put the Bible around their opinions instead of their opinions around the Bible. This way you can make up anything. Few are willing to follow the paper trail.
[Gen 1:1-2 NETS] In the beginning God made the sky and the earth. 2 Yet the earth was invisible and unformed, and darkness was over the abyss, and a divine wind was being carried along over the water.
Genesis Chapter 1 is a progression of creation day by day. Step by step (usually that's how most anything is created. cars, homes, cities, etc), In verse 2. It is still tohu and bohu, that is abysmal chaos.
tohu: formlessness, confusion, unreality, emptiness
bohu: emptiness
The implication is nothing has been created, there is no earth. There is no suggestion of prior creation.
The Spirit of God is hovering over the tehom, that is the abysmal chaos.
tehom: deep, sea, abyss
If anything "existed" in Genesis 1:2 then that would be water. There is no universe in the Bible, there is no space. There are waters!
[Psa 24:1-2 NIV] Of David. A psalm. The earth is the LORD's, and everything in it, the world, and all who live in it; 2 for he founded it on the seas and established it on the waters.
[Psa 136:3, 6 NIV] Give thanks to the Lord of lords: His love endures forever. ... 6 who spread out the earth upon the waters, His love endures forever.
[Psa 74:13, 16 NIV] 13 It was you who split open the sea by your power; you broke the heads of the monster in the waters. ... 16 The day is yours, and yours also the night; you established the sun and moon.
[Psa 148:4 NIV] Praise him, you highest heavens and you waters above the skies.
Earth is created on day 3, sun is created on day 4. There is no sol-ar system in Genesis or the Bible!
[Gen 1:10 ESV] 10 God called the dry land Earth, and the waters that were gathered together he called Seas. And God saw that it was good.
[Gen 1:16 ESV] And God made the two great lights--the greater light to rule the day and the lesser light to rule the night--and the stars.