If the afterlife was a dream as presented in the opening post of this thread, considering that those who “dream” it don’t live to tell the tale of it, we would be left with only those “near-death” who “returned”, and, considering that they, thereby, never died, their experience was most certainly an idiosyncratic dream.
Our experience of the plausibility of the afterlife, however, is really derived from a number of related factors that we experience while fully awake.
At it’s foundation, the afterlife is a fantasy concocted to cope with the egoistically difficult if not impossible to face reality of the finality of our ultimate demise.
And, if we are reminded constantly of our imminent death when we are very young, we will be quite prone to anything that relieves us of the psychological pain of that constant fear, even fantasy.
Add to that the fact that our brains are still developing with respect to emotions. At one time, our ancestors had a difficult time grieving, mourning the loss of a loved one, due to inadequately developed emotional brains compared with ours today. It was a lot easy to say “she’s gone elsewhere” than to face the emotional finality that she would never be again and simply, respecting Occam’s razor, say “she’s dead”, appealing to the common reality that dead simply means "no longer alive, period, and that the condition of being dead is just that: “permanently no longer alive”. So denial of reality continues to contribute to the delusion of afterlife, complete with traditional tales of the fantasy handed down for millenia.
And because even though our loved-one may have died, we still have memories of that person within us, and having those visions of that person within us gives the illusion that she is “still alive” (within us), and such adds a bit of fuel to the afterlife fantasy fire.
Add all that up, and the illusion of afterlife is quite the waking phenomenon concoction.
Any near-death dreams about the afterlife are most certainly, therefore, linked to those components that cause us to fantasize the afterlife while we’re awake, and thus they are understandably topically apropos to what one is experiencing at the moment near to before we nearly die, thereby accounting for this particular dream.