The Rams solved two problems (as you said). They acquired a better QB and they were able to move the current QB and his salary that they didn't want. It cost them in draft picks. But Snead has always used especially 1st round picks more like poker chips.
And, we of course can't just waltz by the fact that they spent a lot to get Goff in the first place. On the other hand it's not like it was a complete bust. We got a lot of victories and a Superbowl appearance from him with those picks. Everything costs something.
Goff never became what McVay hoped for, so it was time to invest again. So the Rams did just that. Sometimes I just slap my forehead at those who wanted us to both hang on to Goff but also demanded a return to the Superbowl. All McVay had to do was sprinkle some magic dust over Goff and voila! It's back to the Superbowl. We'll never know for sure if those two things were compatible; clearly McVay didn't think so. So rather than hemming and hawing and fretting and trying to take a consolation prize like Darnold who just could never get his act together, and hope that McVay could get something more out of him than Goff, the Rams went for broke. They went after the best QB that was actually attainable (not some highly improbable pipe dream like Watson or Rogers). A very good QB that throughout the league he is considered top flight, but has suffered through being on a crappy team for his entire career.