This is an interesting question. On reflection, do you think the classical composers from the classical period were all wholly original? If they were, then how come there were "periods" where virtually everything from each musical period is instantly recognisable by style? Don't you think Mozart ever recalled a pattern or a melodic fragment?

Or even Bach and Handel, God forbid?!
Improvisation and composition both contain elements of the familiar and elements of the totally new. When I improvise (jazz), I sometimes use parts of familiar patterns etc, but every now and then a totally new idea springs into my head from I don't know where, and out it comes, startling/amazing myself as well as my fellow musicians.
I have a feeling the inspirational moments occur in or from a different part of the brain - the right-hand side where creativity apparently springs from. It's a wonderful feeling when it happens, and sometimes I feel a strange sort of pressure on my left-hand side (the left governs the right and vice versa). It's more likely to happen when you're well rested and refreshed, and/or have been doing a lot of playing immediately prior, although having said that it can also happen when you're dog-tired - perhaps this is because the "thinking" part of the brain is just too tired to get in the way.
The place you're in when these moments happen is sometimes called "the zone"; perhaps the truly great composers found themselves in the zone when they composed their best works.
I sometimes wonder if too much jazz tuition can stifle the zone and make people approach jazz too theroretically. Or perhaps it's just second-rate jazz tuition. I only say this because a local (schooled) jazz musician of my acquaintance frequently plays the dullest and most formulaic solos I've ever heard. Perhaps, as an artist friend of mine likes to say, he needs to "unlearn" some of what he's learnt in order to break free.
It's a fascinating subject for sure.
Violinia