Why are there such an abundance of Excelsior class ships in the late 24th century?
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.
I describe it as the Federation taking a "peace dividend" at the end of the Klingon Cold War that disrupted new starship development for a generation or longer. Excelsior-class was the best platform to result from cold-wartime development and thus became the workhorses that lasted through the transition to the more "peacetime developed" heavy explorers like Ambassador and Galaxy-classes.
The real-world parallel are the US Navy Arleigh Burke-class destroyers. They were the peak design at the end of the Cold War, a peace dividend was taken which slowed shipbuilding at the time, their overly ambitious successor classes were ultimately unsuccessful, and it was decided to cancel the newer Zumwalt-class after only 3 ships and instead keep building more third-generation Arleigh Burkes.