Hey LS👋
I don't know about the 'waking ones self up from a bad dream may cause harm' thing but it doesn't really ring true to me. I mean they should be happy to wake up from a terrible nightmare for example.
But in terms of medication actually effecting dreams, yes, I've heard people say that that is the case for them and I can believe it. Afterall, these meds are doing stuff to the brain, to the mind. And a person's mental/emotional state in the waking state can definitely effect dream content because it's happened to me many times: direct correlations of emotional state projecting itself into the dreamworld.
So, yes, it's very interesting.