Disconnect the cable from the RD and remove the cable and housing from the RD.
Pull some shift cable at the lever so there is slack there.
Now manually operate the RD while cranking the pedal. Does it move freely small to large and back. If not then why? Rusted up? Damaged somewhere?
Operate the shift lever. Full travel, smooth and easy. If not then why?
Now use the lever to operate the cable through each housing section, one at a time. Full travel, smooth and easy? Slide each housing section down the cable a ways to expose the cable. Rusted? I see a lot of cables that look fine from 5 feet away but are all rusted inside the housing. If any rust then change cable and all housing for that run.
I would not be surprised if the problem was a rusted cable and housing liner. Don’t try to save it. Change it.