I'll preface this with saying that I have yet to experience any of Dunhaven's notorious side effects, and doubt that I will. Moving on: there are many religions that stem from the belief that life must be lived many times before all its lessons can be sufficiently absorbed. The final end varies - true death is one, as is nirvana - but in many cases, life is not a brief flicker but a guttering flame which must be continuously fed with knowledge gleaned from many hardships and trials.
An understanding of one's past lives - if that is what we're considering these memories, which, for the record, I do not believe they are - is essential to reaching enlightenment. Typically it isn't a punishment so much as an acknowledgement that one has led a full, if difficult life... although I can certainly understand why it would feel like a punishment, depending upon what you have been forced to experience in your sleep.
(I've always had a soft spot for the Christian concept of Purgatory, if we're examining the notion of learning from past experiences. It seems the only version of an afterlife that allows for the possibility of improvement rather than an official judgement of "good" or "bad"; that said, I do not believe this to be a purgatory, Alighieri or otherwise).