To answer that question, let's talk about Starfleet's expectations for a new class of heavy cruiser/explorer. The Constitution class was in service for at least 50 years. NCC-1701 was commissioned in 2245, but it wasn't the first Constitution class ship. So lets say that the first one was launched in 2243. They were in service until at least 2293, but probably even later than that. It also had three significant refits over the course of it's 50-year service life.
The Excelsior was commissioned in 2290 after the great experiment failed. By 2293 it was Starfleet's pride and joy, and the first Federation ship named Enterprise that wasn't a Constitution class was an Excelsior. The basic Excelsior frame is apparently extremely durable and versatile, since Starfleet began producing them en masse.
It was Starfleet's biggest, meanest ship for about 20-30 years, from the 2290s until the 2320s. This mirrors the Constitution's service life as well. When Starfleet designs a new front-line heavy cruiser/heavy explorer, they apparently expect it to serve for at least three decades in that capacity, and then at least another two as an auxiliary cruiser/explorer.
The Ambassador was clearly slated to replace the Excelsior as the pride of the fleet. But for whatever reason, the Ambassador didn't have as privileged a run as the Excelsior.
Why?
Politics.
In the early-mid 24th century, the Federation didn't have many enemies. It was a time of relative peace. The Romulans had withdrawn behind their own borders, the Klingons were still recovering from Praxis, the Ferengi were unknown and the Cardassians were upstarts. They didn't really need another big mean ship like they needed the Excelsior in the 2280's, at the height of the Federation-Klingon Cold War.
Furthermore, because the Federation is in such a strong position relative to the other galactic powers, Starfleet has returned to it's original mandate: exploration and humanitarian operations.
Think about it from the perspective of the admiralty. The year is 2340 and you're the admiral with ultimate authority over the construction orders at all of Starfleet's various shipyards. The situation is as follows:
- The Rear and Vice admirals commanding fleets out of frontier Starbases tell you they need more ships to support the expanding Federation border.
- The Romulans are quiet.
- Peace negotiations with the Klingons are proceeding smoothly, especially since Capt. Garrett gave her life, ship and crew to defend a Klingon outpost.
- First contact with a race called the Cardassians has occurred recently. They have some bad blood with the Klingons due to a dispute over a dilithium-rich planet in the Betreka nebula, and the Klingons are our allies now, and they might require our assistance. However, all intelligence on the Cardassians indicates that they are several decades behind Starfleet in terms of technology and they don't appear to be catching up to the Federation's tech level.
So, Admiral, Utopia Planitia wants to know: what are we building for the next few years?
- Build more Ambassador class ships. The Ambassador class design is about 15 years old now, tried and true. Ambassador class ships are expensive, both in terms of time and material. However, they easily outclass the known Cardassian counterparts of the time. On the one hand, building more of them would be a potent show of force, but on the other hand, we need a larger fleet more than we need tougher ships.
Or,
- Build more Excelsior class ships. The Excelsior space frame is aging at this point, over 50 years old. But the Excelsior class is one of the most successful ship classes the Federation has ever built. They are durable and easily refittable, and they have enough internal space to be fitted for a wide variety of missions. In fact, the Excelsior herself is still in service at this time, 50 years after her commissioning. Unlike the Ambassador class they are no more powerful than Cardassian counterparts, but we have perfected the manufacturing process at this point and we can build a lot of them cheaply and quickly, and we need lots of reliable, speedy ships to support our growing network of colonies.
The choice is pretty obvious. The Ambassador class, despite being a better ship by just about every measurable metric, gets sidelined. Meanwhile, Excelsior production accelerates because the Federation needs more ships. This is why, by 2365, there appear to be more Excelsiors in service than Ambassadors, despite the fact that the design is 80 years old.
A lot of starfleet technology by the 24th century is modular relative to the actual frame of the vessel.
We've seen ships eject and recover their own warp cores a few times in the series and shields emitters are able to be upgraded and become more efficient and powerful over time. The same can be said for phaser technology.
Nacelle placement and hull design have some impact on the maximum warp a vessel might achieve and for how long, but generally speaking this is at speeds that a workhorse vessel doesnt need to achieve and for quick bursts structural integrity fields should hold. Improvements in hull plating and armor composition also give us minor but important gains in taking hits when shields go down but this is less essential during peacetime.
In addition that the class was ahead of it's time. As a result of being designed to chase transwarp speeds the excelsior class' hull design was better able to adapt to 24th century warp technologies and wasnt dated as quickly as it's contemporaries.
So it was a good sized vessel, reliable, had an innovative hull design, and was easily able to be upgraded to have a faster warp core, more powerful phasers, and better shields and structural integrity fields. As an exploration and science vessel it was ideal, and if it needed to defend itself or aid another vessel it was still more than capable of holding it's own and then some.
It wasnt until the borg and the dominion war that the federation had pressures again to start pushing out more sweeping upgrades to their fleet and the result of that was a more battleship like combat ready fleet.
It seems like during the dominion war a lot of ships were taken off mothball status and retrofitted to join the front lines and I'd wager a good chunk of them were left in service after the upgrades and even found to be worthy of future retrofits. Like we see the Titan during Piccard is still a constitution class, but it is a very modern vessel.