Given how many starship classes we see, Starfleet must be forever actively retiring ships if "having two types of ships operating in the same role [to be] redundant". It's also clearly a policy that isn't applied rigorously given how many Excelsiors and Mirandas we still see, which by the 2360s shouldn't be the best classes for anything.
This is a headcanon thing, but I've used it elsewhere to explain the lack of e.g. a Miranda replacement – some classes of starship just prove to be so reliable, so upgradable, so flexible, that a proposed replacement just barely gets off the production line before it becomes outdated itself, and so it is only ever produced in tiny numbers.
We might assume that a replacement plan for the venerable Excelsior-class began in the 2320s following the retirement of the NCC-2000 herself (cf. PIC S2 production information), with the final Ambassador design ready to go by the 2330s. And a handful of Ambassadors were built, with a focus on exploration and first contact missions as implied by the class name itself. With its unprecedented saucer and engine volume we might also assume this allowed for longer missions with less support with more crew in greater comfort, and the ship itself had significantly greater range and endurance than the Excelsior.
But the Excelsiors just... lasted. Retrofitting them with technology derived from the Ambassador development project proved surprisingly easy, and given that Excelsiors are a third the volume of an Ambassador it was possible to upgrade multiple Excelsiors for the resource cost of one Ambassador. Except for deep space/long-term exploratory missions where the Ambassador had a clear advantage, it was just easier and cheaper for Starfleet to keep upgrading Excelsiors. Hell, it was cheaper for them to build brand new updated Excelsiors from the keel up! As a result the Ambassadors were produced in much more limited numbers than expected during the 2330s, and by the mid-2340s plans were already afoot for the successor to the Ambassador to resolve a number of perceived shortcomings in its design – a ship of unprecedented size, power, and prestige in the form of the Galaxy-class.
We kind of see all of this a generation later with the Galaxy-class being a very resource-intensive ship only produced in relatively small numbers. The TNG Technical Manual says Galaxies were produced in batches of six; we have on-screen evidence for at least thirteen (Galaxy, Yamato, Enterprise, Challenger, Odyssey, Syracuse, Venture, plus a number of unidentified ones that might or might not have included some of these named ships in various Dominion War fleets and VOY: "Endgame"), suggesting that at least three batches were built, possibly four if we suppose that we don't keep seeing the same small group of Galaxies over and over and over. By the 2370s the days of the Excelsior-class design are finally waning, but Starfleet is putting considerable resources into building numerous ships much smaller than the Galaxy-class – Intrepid, Akira, Sovereign – in more specialised roles. Going by PIC S3 it looks as though the Galaxy has long been out of production by the 2400s in just the same way as the Ambassador has been by the 2360s, a victim of her own technological success and changing Starfleet priorities. If the Ambassador followed the same trajectory we see the Galaxies follow in later decades, there may have been fewer than twenty of them produced in total – compared to the at least SIXTY Excelsiors we have on-screen evidence for – with a loss rate of ~25%. By the time of the Dominion War there may simply have been too few operational Ambassadors for them to be obvious fleet members.
This is the argument I have to explain the Ambassador being conspicuous by its absence in the Dominion War fleets, because they absolutely SHOULD have been there, even if only glimpsed as low-quality background models, and it sucks that the production team actively decided to not have them. And maybe they did serve in the Dominion War, but their ageing designs and limited numbers ensured that they are never in the fleets we see engaging the Dominion on the front lines. Maybe they were doing the jobs that the wartime Galaxy-class ships should have been doing – big enough and grand enough for the diplomatic missions, but no more powerful than the uprated Excelsiors we see making up the backbone of so many Dominion War fleets. Maybe they formed the heart of the Federation's inner defensive perimeter around Earth and the other core planets. Maybe they took over as the core heavy transport ships for the War effort – much larger than any other ship apart from the Nebula and the Galaxy, which were needed elsewhere, and fast enough to do the heavy lifting of weapons, personnel, and other necessary supplies at warp 9... pack in crew to the same density as on a 2260s Constitution-class and an Ambassador could easily carry between five and six thousand people.