I'm not sure how you're defining music, but I would consider a bird's song to count. On one hand I don't believe music can be reduced to a mating display, but I'm skeptical that music has a biological root in processing memories/emotional response. Sure, it can stimulate memory/emotional processing, but so do most other social activities. Moreover, I think conversation, games, music, dance, etc. are much more similar to each other in that regard than dreaming is to any of them.
In my experience, dreams are wild extrapolations/interpolations of various waking experiences. When I'm awake, I would call this imagination, but the unconscious mind appears to put the imagination into overdrive in a way that is not possible while awake. It's almost as if the brain is trying to generalize memories, possibly to optimize them for storage space. (or some biological equivalent)
Interestingly, /u/undershirt mentions that it might be that you don't actually experience the dream until you wake up. This would make sense, as this process would be interrupted, leaving you with some bizarre false memories. The unconscious then quickly cleans up it's mess and hands control over to the conscious mind.
On the other hand, I think music is explained fairly satisfactorily as a positive social activity, related to dancing, both of which were ubiquitous and inseparable in ancient cultures. In a world where you have to make friends and be wary of enemies, it's not hard to see how bonding activities that signal friendliness are valuable for natural selection. Even birds sing, humans just have a much more complex songs.