David W. answered 05/07/19
PhD in Music Composition with 5+ Years of Teaching Experience
This is not a question with a short and tidy answer. The germ of a composition can be melodic, and harmonies are found to support it and bring it to life; or it can be harmonic, and melodies and rhythms can flesh it out; or it can be rhythmic, or it can be formal, or some combination of these. There is no one way in that works every time. The study of harmony and form and orchestration is meant to give you the tools you need to create music, not a blueprint. All of the different strands interweave to make a piece of music.
Also remember that all the theory and harmony you've read is descriptive, not prescriptive; it is a distilled version of what past composers have done. You can follow their lead, or not. When you analyze existing music, you find out how it works; if you want your music to work the same way, you can use the same tools.