When the Dominion first began its military buildup in some Gamma Quadrant nebula, they already held the advantage. The Federation had just gone to war over the Archanis sector with the Klingons and then fought a Borg invasion that went from the Typhon sector all the way to Earth's solar system. Starfleet was not prepared for another conflict. Then once the Dominion moved its invasion fleet into the Alpha Quadrant, things got even worse when the Cardassians pledged the full support of all its military forces to the Dominion as well.
The Dominion was already in a good position to attack and the Federation knew it, so they quickly resigned the treaty of alliance with the Klingons. But even then they weren't all that confident they could hold back the Dominion.
To further secure their position the Dominion sent even more warships and ground troops to the Alpha Quadrant. They also offered non-aggression pacts to every other major power in the Alpha Quadrant. The most important was to get the Romulans to sign since the Romulans had attacked them in the past and like the Klingons and the Federation, considered the Dominion a huge threat.
Now suddenly the Federation decides to mine the only passageway to the Gamma Quadrant and the rest of the Dominion. It's not surprising the Dominion considered that an act of war and attacked right away.
If the Dominion waited around to build more ships, it would make them look weak for not standing up to the Federation. They may lose respect from their new AQ allies including the Romulans. Federation diplomats will be constantly trying to turn the AQ powers against to the Dominion. And while the Dominion is building ships, Starfleet can also rebuild their ships lost during the Borg invasion. There's also the issue of manpower. The Dominion did not breed AQ Jem'hadar until after its reinforcements were destroyed by the prophets. So even if they did wait around to build more warships, they will need the troops to man them as well.
Obviously in retrospect the war didn't turn out well for the Dominion. But at the time the minefield was put in place, the Dominion did hold every advantage. If they decided to stay in Cardassian territory and build more ships, who knows how long that advantage will last. The Borg, unlike the Dominion always just goes straight for Earth. They didn't attack any Federation shipyards. So in a year, Starfleet could be back to full strength. The Romulans, the Tholians, maybe even the Breen might decide to come out of isolation and turn against the Dominion.
Ironically the Dominion might have tried to learn from the Borg. When the Federation committed its fleet to retake DS9, they had the opportunity to launch a full scale invasion of Earth. But of course, they had no idea that the prophets would destroy their reinforcements.