First of all, it's not just one verse out of many that is figurative. It's the whole story as related in Genesis 1 that is figurative.
One of the reasons why I've never liked the term "allegory" in reference to Genesis 1 is that in allegory, specific things tend to refer to specific qualities. So, in allegory, if we have a character called John Faith, he will represent "faith" as a quality. Or a particular plant, like Honesty, could represent a quality ("honesty", obviously.)
So in trying to interpret particular verses, I think you're onto a loser. It doesn't mean anything without the rest of the story. The whole story tells us something about God as the creator of the universe: that there is only one God, that what God created was good, the universe is separate from God, that God created human beings etc... The word Adam may have a symbolic meaning as it is the word for man, but is also related to words for "blood" and "hearth" for instance; but it is best to take the message of the passage as a whole, rather than using this cut & paste method of "what does this verse mean when wrenched from its context?"
So why did the writer do it this way around? Well, firstly, you have to remember that the writer was not a scientist; if anything he was a poet, certainly a scribe. He's not interested in 20th/21st century notions of absolute scientific accuracy; he's telling a story. If a storyteller says something historically or scientifically inaccurate, most of us don't mind as long as the story is good. Most of his original hearers wouldn't even have been able to read, so it's unlikely that they would have cared about scientific accuracy. What they wanted to hear was a story with truth in it.
The detail of the plants before the sun is just a detail in the overall story, just as in a story, someone enters a room, someone gets in a car. It doesn't have meaning in isolation from the rest of the story.
If you want to know the truth of Genesis 1, you have to read the story whole. Verses are very convenient for dividing up the Bible into liturgically readable units, but for not much else, frankly.