Wiping out the entire species of the Founders, or something similar if done to the Borg would have been perfectly viable. While the power vacuum left in their wake would have been difficult to manage, there's no reason to think that the galaxy would be in a worse shape without either species.I think your question is too simplistic and framed in such a way as to invite only one way of thinking. Nothing occurs in a vacuum, and the choices we have rarely culminate in dualities where only one choice is the right one to make. That being said, genocide is not a viable answer, and an organization willing to engage in it is not one to be lauded, let alone trusted.
It could be argued that when a thorough assessment of a civilization like that of the Dominion or Borg was done and it found that the species could never be reformed in a way that would keep them from being a primary threat to stability and to their neighbors, that such removing such a species would be a de-infestation for the good of all, and therefore a moral imperative.