It showed some character growth on behalf of Elan. His greatest, deepest wish, and his realization that the real world doesn't work that way.
It has some small plot value (shows the strengths of the pyramid's illusions), has a little thematic value (this is what heroes are all about), and shows...