Isn’t it a problem that Sun and Moon are said to be created (Gen 1:14-17) after the earth (1:1)?

Again, if the narrator of Gen 1 is occupying a position close to the surface of a proto-earth, then at some point, enough of the primordial dust cloud would have settled or burned off that there would be clear periods in which the Sun and Moon became visible, perhaps for the first time. One potential problem here is that the text actually states, “Then God made two great lights” and “God set them in the firmament” (1:16-17); but current theory about the formation of the solar system has it that the Sun ignited before the Earth formed. What is very likely the case, however, if that is so, is that the early Sun and Moon were for a long time invisible from the surface of the proto-Earth, as it was still forming. If so, then the events described as taking place on days 2 and 3 followed the creation of the Sun and Moon, but the Sun and Moon became visible after them.