I guess the brain needs to do something. I have read that it's storing info away during those times. There are methods of increasing the chance of a lucid dream. Check out on the Net.
Isn’t dreaming also about imbedding memory and working through and sorting the days information?
Great leaps in inventions have been credited to dreaming the solution.
Obviously my answer isn’t scientific lol
However as a very poor sleeper with SDAM my memory is very poor. But tbh SDAM often goes hand in hand with Aphantasia so I’m onto a double memory loser lol.
One widely held theory about the purpose of dreams is that they help you store important memories and things you've learned, get rid of unimportant memories, and sort through complicated thoughts and feelings. Research shows that sleep helps store memories.
Control is harder it can be done up to a point. Takes years of practice and discipline. Starting with becoming really good at visualisation so you fix images of themes before you settle to sleep, writing down dreams and practising modifying repeating dreams. It took me two years to sleep to the end of a frightening dream. The answer was in it but I always woke up before the end. It changed my life in some important ways but I have been interested in dreamworking for about 40 years
We probably dream because of a percentage of our being that we don't know much about. It has been written and said that humans use only 10% of their brains. Which probably means that more dreaming than thinking goes on.