Just because the goal is good doesn't mean any means is acceptable.

Literal

Purpose [even-さえ] good-[if-ば] any means [obj-を] take [even-ても] good [reason-わけではない].

Layers two conditional/concessive patterns: ~さえ~ば ('if only, as long as') and ~てもよいわけではない ('it's not that it's okay to'). ~わけではない ('it's not the case that') partially negates the preceding clause rather than flatly denying it.