I think we dream because prior inhibited responses to stimulii need to be resolved and cleaned out of the system. The brain creates a little allegory to work them out. If we dreamed about the thing itself, without allegorizing it, the inhibited desire would simply repeat itself.
My theory is similar, or perhaps identical, to yours.
I think we dream to "complete" chains of thought we interrupted while we were awake.
Some nightmares result when we pursue an unpleasant or frightening train of thought during the day, then force ourselves to think about something else because we want to avoid thinking about what we fear.