I think you might be misrecalling or conflating various elements. The 7th fleet once lost about a hundred ships, and that that was amoung the most devistating loses of the war, exceeding only by Chintoka once the Breen joined the war. I can't find or recall any mention of greater loses, and if the federation was losing thousands of ships all the time, that should have been mentioned at some point in the show.
Starfleet was certainly not losing thousands of ships all the time. That would indeed have been really, really bad. As for the 7th fleet, they had actually lost 98 ships. 14 out of 112 had returned. At the Battle of Chin'toka, they had lost 311 out of 312 ships.
The only high end number is the 30k dominion ships figure from "When it Rains", a figure derived from the low end consistent figure that the Klingon fleet was only about 1,500 hundred ships strong, and if the Klingon fleet had been whittled down a merely fraction of it's pre-war numbers, that's again something someone should have mentioned at some point. Everything else, from TOS to Wolf 359 to Nemesis to STO, suggests a fleet in the low thousands at most.
You're mistaken, I'm afraid. Sloan from S31 told Bashir that the after the Dominion War, the Klingons would need 10 years to rebuild from their losses. This is not surprising, as the Klingons had gone through a bad time. They invaded Cardassia with almost a full third of their military assets. For a full year of the Klingon's invasion and occupation of Cardassian space, the guy in charge of the invasion was...General Martok. As in, his Changeling imposter. Who had every incentive and opportunity to make sure he inflicted as much damage on the Klingons as he did the Cardassians and Federation forces. By the time the Dominion forces "liberated" the Cardassians, the remnants of Gowron's forces had regrouped at DS9.
Keep in mind the cultural background of the Klingons. They don't shy away from death and so their casualty tolerance is probably rather high compared to what most armies would accept in their position. They also have a strong reluctance to give ground once they take it. I can't imagine Gowron would retreat unless he had suffered catastrophic losses. There was little more than a hundred ships that must have made it to DS9, by the looks of it.
Finally, we should look to Operation: Return. The Federation forces there were outnumbered 2 to 1. And it was more or less a nail-biter until the Klingons arrived with a few hundred ships to tip the balance. We might therefore argue that Starfleet can be expected to win, on average, fights with Dominion ships on a 2 to 1 ratio. The idea that the Klingon's full military might is around 1,500 ships doesn't work with the numbers of being outnumbered 20 to 1. Because that would mean that the full alliance gathered would be outnumbered over 6 to 1. There is simply no way that math works out looking at their previous engagements. Romulans don't change the math either; their Tal Shiar fleet got clobbered when faced with 3 to 1 odds.
What this tells me is that the combined forces of the entire alliance must be 15,000 ships or close to it, otherwise the math just doesn't work. You need at least ~10,000 ships for the allied forces even with 3 to 1 odds. The only way to make this work is for the allied powers to each have roughly 6,000 ships in their fleet. The KDF lost ~2,000 of their forces to the Cardassian War and later Dominion liberation.
The Federation dedicated 4,000 of its ships to the war effort, with another 2,000 ships from the KDF sent from the Empire to bolster their strength. In the early stages of the war, the Dominion was slowly grinding the UFP and KDF fleets into dust. Assuming they needed about 2 to 1 odds, they probably had 12,000 ships, with maybe 2,000 of them being Cardassian warships. The 2,800 ships that Dukat eagerly needed to help bolster his fleet probably would have sealed the deal in their favor for 14,800 ships.
When the Romulans joined the war, they might have dedicated anywhere between 2,000 and 4,000 ships. That would have drawn the number up to 7,000 and 9,000 ships. That was a turning point in the war, as the Dominion began to suffer reversals after that. That would make sense, as the Dominion no longer had the 2 to 1 advantage it needed to maintain its edge. It would have gone down to around 1.3 to 1, which isn't enough.
Honestly, the figures work better if the Romulan General had said 10 to 1. But I suppose it's possible that the Dominion had shifted from building large warships to small Dominion fighters towards the end of the war. That would have greatly bolstered their ship count, while staying within the means of reality. Since the Dominion would then need a 3 or 4 to 1 number count to win, it would explain why they were still losing despite the lopsided numbers. The Breen was their ace in the hole, but after their EMP-esque weapon stopped working, the UFP and its allies seemed to roll right over them.
If Starfleet and its allies had 9,000 ships to the Dominion's 30,000 and the Dominion needed a 4 to 1 win ratio at that point, then it makes sense that they were losing so badly. And of course, we can't forget about Damar's betrayal and taking a good chunk of the Cardassian military with him.