And what was a “day” before there was an Earth and Sun?
I guess we have to assume that the first mention of ‘Light’ in the Bible refers to something other than material light; and that ‘a day’ meant some measure of time or movement between points; not necessarily what we mean by ‘a day’.
I don’t believe the writers of Genesis were lazy or stupid; and many things that don’t make sense to us have to be symbolical.