Let us be very clear that Hebrew has perfectly good words for:
- The sun, שֶׁמֶשׁ (shemesh) which first appears in Gen 15:12
- The moon, יָרֵחַ (yareach) which first occurs in Gen 37:9
Thus, while these perfectly well known words are available, the author of Gen 1 goes to some trouble to avoid using them.
Further, we note that the great lights to rule the day and night are placed in the firmament (Gen 1:14); now, according to Gen 1:6, the firmament is the space (sky) between the water below (rivers, seas, lakes, etc) and the waters above (clouds or the source of rain, hail & snow, etc).
Thus, if a pedant wanted to be really pedantic, then one might erroneously conclude several bizarre things:
- The sun moon and stars were created on day 4
- The sun and moon are within our atmosphere and travel trough it.
However, the author of Genesis carefully avoids this problem by saying that:
- It was the lights that were provided on day 4 and not the actual sun and moon themselves
- It is the light from these bodies that is within the atmosphere not the sun and moon themselves
The conclusion here is simple - the sun and moon might have existed well before the start of creation week having been created at an earlier unstated time.
Of course, the human author could not have known the full implications of what they wrote and this (I believe) is an evidence of the divine origin of the inspiration of the author of this part of Scripture.