Your book example is a different question entirely.
Look at it this way. You can also take a song with a melody, and completely alter the melody into something entirely different, but it doesn't mean that you get a songwriter credit on the new version. If it did, people would be doing this all the time. And the original version of the song isn't "half a song", as in everything but a melody - not legally speaking. If that were true, we'd have thirty years now of people trying to write melodies for already-released rap tunes, in an effort to get their financial cut.
So legally speaking, putting a melody on a rap tune still only yields a derivative work. Coulton has no rights as a songwriter in this case.
Again though, if Fox took the audio to his backing track... that's a different matter entirely.
One big asterisk, though. It might be too late for this, but Coulton arguably could have gathered more leverage had he called his version a parody. But that's a really high bar, because for it to be a parody, it would have to implicitly comment on the previous work, thereby transforming it. As opposed to a simple satire, which "builds on top" of an existing work. A parody is protected by fair use, and it is possible to copyright the original parts of the parody. So if he had been able to argue that his song was a parody, he could have copyrighted the melody. And given that Coulton's artistic choice was limited to putting a nice melody on top of a rap tune, I doubt that would hold up in court, because it would set a hell of a precedent to all the other rap tunes out there.