The end of his career? He's only 32. He's still probably got 4-5 quality years left in the tank and LA is clearly in win-now mode with the talent they have on defense. I may be higher on Stafford than others but IMO this is a significant upgrade and makes them favorites in the NFC West next year.
The other thing to factor in: Goff's contract was HIDEOUS. So they probably had to throw in added value to get any team to take it.