Some writers are able to think of stuff while they write.
I sure can think of stuff, but it is almost always clever, glittery distractions from whatever it is I am trying to accomplish. Pointless flashbacks, cool devices, elaborately describe artworks...name it, I've done it.
In order to actually write a scene, something unified in space and time that has a structure and focus and conflict and a decent ending that kicks you into the next scene, I have to already know all of those things before I actually write it. I've learned this through long experience.
And all that is hard for me, and takes a long time. Sometimes I start writing, with a good amount of planned material, and tear through it, and run out of plan. It really is like driving a locomotive off the end of the tracks. No progress, and a lot of frustration.
So I always have to make sure I've excavated, distributed the ballast, built bridges across particularly perilous obstacles, dropped the ties, and nailed the rails on before I get going.
I'm working on a novel just now (a hefty expansion of my recent novella, "The Forgotten Taste of Honey") and ran out of rails. I got to a location, looked at my notes, and realized they were entirely too vague, lacked conflict, and in general were lazy generalities. Who wrote this crap?
So I just spent almost two weeks (I'm not fast) really getting into it. Now I think I have what I need to get through it. Can I actually work ahead in enough detail to keep my locomotive from burying its nose in the mud again?
I'll let you know.