Having the sun appear after the light would have been very significant to pagan world views which tended to worship the sun as the source of all life. God seems to be making it pointedly clear that the sun is secondary to himself as the source of everything. He doesn't "need" the sun in order to create life, in contrast to old-earth beliefs.
In fact, early church writers used the literal fourth day creation of the sun as a polemic against paganism. For example, in the second century, Theophilus, bishop of Antioch, wrote in an apologetic work to the learned pagan magistrate Autolycus:
On the fourth day the luminaries came into existence. Since God has foreknowledge, he understood the nonsense of the foolish philosophers who were going to say that the things produced on earth come from the stars, so that they might set God aside. In order therefore that the truth might be demonstrated, plants and seeds came into existence before the stars. For what comes into existence later cannot cause what is prior to it.
In the 4th century, Basil the Great commented on the same passage:
Heaven and earth were the first; after them was created light; the day had been distinguished from the night, then had appeared the firmament and the dry element. The water had been gathered into the reservoir assigned to it, the earth displayed its productions, it had caused many kinds of herbs to germinate and it was adorned with all kinds of plants. However, the sun and the moon did not yet exist, in order that those who live in ignorance of God may not consider the sun as the origin and the father of light, or as the maker of all that grows out of the earth. That is why there was a fourth day, and then God said: "Let there be lights in the firmament of the heaven."\
―Jonathan Sarfati, Refuting Compromise