You can always go for a reallife analogy. Building ships is a long and expensive endeavour and the biggest cost is building the base frame. Modern steel navies all over the world hung onto their ships for several decades, refitting and altering them several times over their lifetimes for that exact reason: It's cheaper and faster to retrofit ships instead of replaceing them and if you think about how large space and the Federation is, you better have 1000 ships now, than 250 in 10 years.TGLS wrote:That's a good Doylist explanation, but it doesn't provide a Watsonian explanation. My best guess is that the Federation began expanding quickly, but the military budget didn't grow with it, so Starfleet refit the Excelsiors to pick up the slack.
In reality, pretty much the only reason to get rid of ships always was a technology-breakthrough, that obsoleted the old vessels in such a fundamental way, that they could not be recycled anymore, or the increase in gun-caliber- and armor-need obsoleting old armor-schemes and armament necessities.
USS Missouri, BB-63, for example was built from 1941 to 1944. The ship fought the Japanese and was used as the place where the Empire of Japan signed the surrender to the United States. It took part in the Korean War and after that, was placed in the reserve fleet and used, to some degree, as a museum ship, only to be reactivated in 1984, refitted with, among other things, Tomahawk cruise missles and Harpoon anti-ship missiles plus, of course, the Phalanx CIWS, in effect making it and it's Iowa sisters the largest guided missile vessels ever built and, if memory serves me right, the only guided missile battleships ever. It used that power to bombard Iraqi forces during the First Gulf War and is currently placed in the reserve fleet again, which means it's still there and ready to go to war in a moment's notice, 76 years after it was "born". She also "starred" in a movie, where the protagonists do exactly that to great effect against an alien invader, in an absolute spectacular sequence of fire and fury, but I digress.
This is just one example of "recycling" a ship over a long period of time and this isn't even an example where the ship was truely extensively rebuilt. There are examples of ships that didn't just get new armaments, but were rebuilt to a degree that they don't resemble their original form at all. Have a look at the Kongo class for example, which started out as midly armored dreadnought-type battlecruisers in 1911 and ended up as a major threat in the Pacific Theatre of World War II as true battleships. Or the italian Giulio Cesare, built in 1910 as a 3x3 + 2x2 305mm armed ship at 175m length and ended her life in 1955 (after being struck by a german WWII mine of all things) being armed with 2x3 and 2x2 320mm rifles and a length of 186.4m. That ship got a whole new prow attached during a refit, where the old bow actually remained and was part of the armor behind the new prow (to get a nod to the refit of the Constitution-class

And this really makes a lot of sense if you think about it, because a battleship throwing 9 16 inch armor-piercing shells in your face, will hurt any target as much today, as it did hurt it 76 years ago, unless the target in question comes up with a major technological breakthrough like energy shields, but even then, the kinetic energy of the impact and the heat- and pressure-energy released by the explosion of the filler is still a tremendous amount of energy to deal with even for an energy shield ala Star Trek, because physics is a bitch yo. And even then, if your guns aren't enough anymore, remove them and the turrets that are housing them and replace it by high-yield energy weapons. Instead of having to built a new ship within 5 years, you can get a similarly powered ship for a fraction of the cost in one year. Why waste a perfectly viable and available resource?