so i've heard of this idea or versions of it in a few places. the first place i heard it was the movie "waking life" over ten years ago when it first came out. i just re watched it and now i'm wondering: where does this idea come from? is there a religion that teaches this is the case or something?

the idea as presented in the movie is that death is wrapped in a dream. after we die we enter this dream in the same dream body that we use for dreams now, only we can never again wake up.

any background on this idea whatsoever would be nice. thanks.