If you want a very good “model” on how to go about that, try the Edna Mae-Burnan’s books (“A dozen a day”). The books consist of sets of 12 exercises (each book has 5 sets and there are some five or six books of increasing difficulty), 11 “pure exercises” and the 12th a little tune.
Although one gets the impression that the last exercise – the little tune – is the application in practice of the previous 11 exercises, in fact I believe (and maybe I am wrong here), that Edna started by composing the little tune, and then devised the exercises to make the tune easy to play.
Unfortunately the little tunes are nothing to write home about. (She was a good pedagogue, but not a superlative composer).
However, examining the books form this angle, should allow you to pick up a superb tune and write up 11 exercises leading up to it.
The beauty of this series is that it is very elementary, so the process becomes transparent.
If you want to see a similar process applied to advanced repertory, try the several “Editions de travail” (Work editions) of Alfred Cortot. The Chopin Etudes are very well known, but he produced similar editions for the Preludes, the waltzes, the Nocturnes, etc. and also for other composers, like Schumann.
Best wishes,
Bernhard.