This is way more information than I expected. My main experience with this subject has been bands I am familiar with.
Let's take Metallica as an example.
Lars Ulrich is a songwriter on (I think) every single song - only because he suggests arrangements. I find it a little uncommon to credit a drummer as a songwriter.
Jason Newsted was credited with only 3 - where he came up with main riffs of the song. His bass lines only didn't count.
Only using them because I am familiar with the requirements they had on being credited.
So, there's a little bit of two things going on here. What the law says is copyrightable, and who gets credit for ownership of that copyright.
The melody and lyrics are copyrightable. The person or people that create the melody & lyrics own the songwriting copyright. No other contribution to the song counts. They are the ones who can make money from the use of that copyright/copyrighted material. If someone else wants to use that melody or those lyrics needs to get permission from and pay the copyright holders.
The writer of the melody and writer of the lyrics technically own the copyrights on creation of those intellectual properties. In isolation, if you write lyrics and a melody, you have created a song and own the songwriting copyright. You can write all sorts of other elements to the song too. None of those matter. You write the melody & lyrics. You own the copyright. However, that doesn't hold up in court so to actually protect your copyrights, you have to register them to actually enforce your ownership.
By law, the arranger doesn't have a right to any portion of the copyright for the lyrics or melody. If you composed a song and hired an arranger to make an arrangement of it, they don't have claim to songwriting copyright ownership. They arranged it. Same goes for studio musicians coming up with their part from the chart while you record. Same goes for the producer and engineer. They didn't create the melody and lyrics.
However, if the writer of the melody & lyrics contractually agrees to give the arranger a portion of the songwriting ownership, they can. I don't know what kind of contracts the members of Metallica have signed with one-another, but there's probably something in there that states "Lars is in charge of doing X, Y, and Z, and will get [some percentage] of ownership of the songwriting. If you write a song for the band and we decide to record it, you must give [some percent] to Lars and [some percent] to James, otherwise we're not going to use your song." But they're not getting a copyright for the arrangement. The writer is giving a portion of their ownership of the melody and lyrics.
If there was no agreement in place superseding the sharing of ownership, Lars wouldn't have a legal right to any of it for doing arrangements.
Same thing goes for pop artists who buy songs from songwriters. The songwriter owns the song they wrote. Pop artist crosses out one word and changes it to another word and demands [some percentage] of songwriting credit knowing the songwriter will probably agree to signing over an outsized portion of their rights because if they don't, the artist will just pick another song. Meanwhile the artist now collects royalties for the copyright because they're part owner because they changed a part of the melody or lyrics.
You could even write an original song and give complete ownership of the copyright to some random person or company. It's yours to do with what you wish until ownership is transferred or split.
***again: I'm not a lawyer.