The first purpose is to explain what exactly happened in the great burning, and to help the John (and by extension, the reader) understand that it was mankind that destroyed themselves, and not some strange event caused by Gods. It was simply a literary tool, and a handy one, to help explain what had happened, like a flashback in a movie.
A second purpose would be to remain true and faithful to the storyline of a tribe that sends its young men out on spirit walks. In many cultures, the young men participating in these vision quests, or spirit walks, did have actual visions or spiritual experiences that revealed great truths to them. The entire story centers around John, a young tribesman, who goes out in search of wisdom and learning in his tribe's version of a vision quest. The vision that he received was his answer, and he was able to go home and tell his father about it. His father was able to conclude that was a true vision, and one that John was meant to have; this was all part of their culture, so the vision that the author describes stays faithful to it.
I hope that helped; good luck!
I believe that the author includes this experience because it is essential for the story. If he did not include it, how would John know about what the city had been like?
One of the main points of the story is that John learns that it was people who built the city, not gods. Because of that, he starts to see that his people can potentially become technologically advanced like that some day. We are left to wonder (and the author wants us to think about this) if this is a good thing or a bad thing.
If John did not have that experience, how would he have found out that the city used to be inhabited by people? How would he have known about the war that destroyed the city?
I think that the author needed to be able to show us what had happened and he had to have John learn what had happened because otherwise the main point of the story would be lost.