I'm writing a novel. Number seven as it happens, and it'll probably join the others on that great unpublished shelf in the sky. But I've also been reading, and listening to podcasts, about the way the brain works, and my writing "technique" seems to offer persuasive evidence for the idea that various parts of the brain work almost independently of each other. Each one goes its own sweet way, occasionally coming up with an idea, a decision, a bodily movement... Many of these are actioned, some of them actually come to the notice of the conscious part that we tend to think is the "real" me, and some come as complete surprises.
You'll hear authors (if you have any interest in listening) saying things like "I don't write the story: it writes itself" or "then this character did something I wasn't expecting". I've used those lines too, and recently came out with "my main character hasn't told me what the story is about yet". Some of this is affectation, but it is surely a gloss on the feeling we have that the mental wheels keep on churning whether we are aware of it or not.
An idea comes to the fore - half-formed, fully-formed - and you find yourself typing it in. Sometimes it's a second or two before you realise what is coming out. Sometimes it's as if that idea "has always been there". It's because you have more than one pair of mental hands at work all the time. You're not on your own in there.