It’s hard for me to think of music as just “melody”. Melody is just one element of music, So there is also harmony, rhythm, texture, timbre, dynamics… etc.
Because a great composer can take a melody and do great things with it, whereas a melody might in itself have potential, but if that isn’t realized, it’s just a “melody”.
But when a composer sets out to write a memorable melody, the other elements you mention (harmony, rhythm, texture, timbre, dynamics) are likely to come later, certainly the last three will. Granted, harmony and rhythm are tied to melody, but they also don’t have to be in the forefront of the composer’s mind. The rhythmic and harmonic variations can come later.