There was a sun in Genesis 1:1 because of the stretching out of the heavens. God has fine-tuned all the laws, constants, and equations of physics for life to exist on earth (Psalms 8:3, and earth hang on nothing because of gravity Job 26:7) and in verse 2 there was darkness over the face of the deep. If you were looking up into space (face of the deep), then you wouldn't be able to see the constellations of the south (Job 9:9, Job 38:31).
Why? Because in verse 3 there was also water on earth. Not only was there gravity to hold the water in place, but also a hydrologic cycle between the sun and earth (Job 38:9). The lights from space was already present and shinning but could not pass through the early earth's atmosphere. It would be like standing on the planet Venus and looking up. You would not be able to see any lights from space because of the oblique atmosphere. So when God said, "Let there be light;" he is not creating the sun's light itself since the sun is already there, rather the early earth's atmosphere changes from oblique to translucent atmosphere. And the earth's atmosphere would naturally take an unspecified long period of time to change.
It was enough light to separate "light" from "darkness" but when looking up into space you still would not be able to see any moons, stars, and planets. You cannot see visible objects in space from a translucent atmosphere. Now in Genesis 1:14-18, the plant life was already created and need light to grow. The plants were giving off oxygen into the atmosphere. After an unspecified long period of time the atmosphere became transparent to the point that our sun and moon, and the planets and stars was made visible. Not made in the sense of created, but made to appear so that you can mark the seasons, days, and years.