As in the bombers example, the previous generation is hardly quickly and completely outdated. They're still nukes. And that's exactly the reason to keep them in service.
Then, when a better tech becomes an option, it doesn't replace the previous weapon, it complements it.
So the options are: 1) retire old weapons, recycle them to build weapons which are expected to be better, keep the military potential about the same, reduce costs but still spend a lot and 2) keep what's in service and build a better weapon. Option 1 is hard to justify politicaly. Scraping something perfectly functional that costs billions sounds like a career ending decision. It also affects too many people. Option 2 is almost a guaranteed way to improve military potential, and a way to have a stellar career. Assuming that funding is available.
So yes, the decisions are not always the most economically efficient. That's a wrong objective function. Especially if we're talking about defense.