Once you realize this, you can take this idea one step further and use the same principle in places where you feel stuck, in places where your imagination doesn't work on the spot, in places where you don't know what to do next.
Repeating one musical idea several times (even if it's not a mistake) on the same or different manuals when you don't know what to play in the middle of the piece will give you time to think, react and it will lead you some place else eventually.
This suite from 6 pieces was improvised for the group of French tourists. Take a look at how you can draw inspiration to go from one music idea to another when you seem to be stuck in one place.
One more thing: even if you feel stuck, always be conscious of the form of the piece, where you are in it in any given moment (otherwise the playing will become like rambling without a direction). The pieces in this suite all have a ternary ABA form so even when I didn't know what's waiting for me around the corner, I knew I had a compass to follow.