Dreams can be shaped by our experiences throughout the day, but also can be influenced by other factors, such as our body's current state of being, our past, and our desires.
For example, I was in the Navy for six years, from 1998 to 2004. It has been 12 years since I've been in the Navy, yet I frequently continue to have dreams where I am either still in the Navy or have rejoined it. I rarely think about my time in the Navy during the day, but because it was a big part of my life, my brain obviously likes to continue using the Navy as a setting for dreams.
Likewise, and I'm sure I'm not the only one, I've often had dreams where I'm in a restroom and there's toilets everywhere and I have to pee real bad, and I'll wake up and be like "Oh man I gotta go to the bathroom." I don't know that it's exactly a matter of my mind trying to tell me to wake up and go, but it could just be a situation where the body uses that feeling (even if we're not awake to experience it) of having to go really bad as a setting for a dream. Same thing with dreams where you're in a very hot location (because your body is feeling hot) or a cold location (because your body is feeling cold).