In many cases, "repaired" should probably be replaced by "rebuilt". Say, West Virginia retained her hull and the barrels of her main guns, but the rest was essentially all-new, and probably a totally wasted effort in providing late in the war the USN with a battleship it didn't actually need.
Are starship hulls similarly valuable templates for installing an all-new ship inside? The "refit" of Kirk's ship puts that in some doubt: nothing about the hull contours was retained in that process. Now granted, West Virginia also had her hull form altered with the addition of anti-torp/stability bulges, but that's still different from re-contouring every single curve on NCC-1701.
So, what is valuable in a starship to be recycled? One might say (and fan works indeed do) that warp coils are analogous to gunbarrels: they are painstakingly cast in a time-consuming process, and may be replaced one by one, perhaps moved from one nacelle to another, from one starship to another. Then again, Starfleet decided to install new warp nacelles and supposedly new coils in the TMP refit.
Is an internal component of some other sort valuable enough to have a new ship built around it? The TOS and TMP warp cores don't look alike - or is it just that we never properly saw (or heard of!) the TOS core, which was actually the same all along? Is the ship's structural skeleton or "keel" something to be retained, even if the hull plates bolted onto it are of all-new shapes? Does a ship have a "soul" of some sort that is handed over, perhaps its AI control system that has accumulated experience and skill within one hull and is now a valuable asset to be grafted to another hull?
Might be the Excalibur gets repaired even when there's no tactical or engineering rationale to it - much like West Virginia. Perhaps Starfleet doesn't want to acknowledge the M-5 incident and needs to pretend that all parts of it eventually unhappened? Or perhaps the treaty signed in the aftermath of "Errand of Mercy" puts limits on building of new ships, so Starfleet is forced to build its new ships underneath the skins of preexisting ones?
I'm all for the "haunted ship" concept in any case, dramatically speaking. The Exeter, suffering 100% casualties without any structural damage, would be another interesting case. Or is it even possible to purge her of the agent that turns people into mineral heaps? Or would this require melting every surface to the depth of half a centimeter, or radiating everything so that the ship still glows as of ST:PIC?
Timo Saloniemi