A new chain or cassette doesn't affect the derailleur. A new cable does, but the tension is adjusted from the shifter, not by messing with the derailleur adjustments. It's true that god-awful shifting due to a bent derailleur can be mitigated to some extent by messing with the adjustments but it'll never be good. It can't be because the derailleur is bent. Then when you replace the hanger with a straight one the shifting goes to shit again.
Whenever my derailleur catches on a rock or a stump and the shifting goes to shit all I do is remove the derailleur from the hanger, use the hanger adjustment tool to straighten it out and once I re-attach the derailleur it shifts perfectly again with no adjusting at all.