I guess a melody has its own implied rhythm. But do you usually write/record drums and bass last?
drums and bass are not necessarily part of the writing. sometimes there will be hints at what's supposed to happen, but writing the song usually does not include deciding exactly what everyone is going to play. when it comes time to do the song, then the players (which all happen to be me) use their best judgement for how to do the song. it's like making a movie or tv show. the script mainly has dialogue, and some basic info about scenes and sets. but the writers don't build the sets, and they are not making decisions about every little item that goes everywhere on the set. that is done by the set designers, but they are doing it based on the way the script seems to imply it should be, even though the details may not be written in the script. they are using their judgement based on the what they can infer from the script