This was a common objection to the notion of
Lucid Dreaming for a long time. Scientists accused lucid dreamers of making up a post-hoc story about being in control.
Finally Stephen LaBerge did a study where he was able to move his eyeballs in a distinct pattern during the REM phase [1], proving that he had conscious control while asleep.
https://www.nature.com/articles/s41467-018-05547-0