The joy of songwriting only gets messed up if you are trying to follow up a big success, or you are trying to create a hit single, or if you have conscious thoughts of a particular outcome for the music.
There are some songs where I'll have had the music for 20 years and then finally the lyric will come through. That's not common but it does happen. Then there are other songs that come really quickly.