How does that description not describe a military if it conducts war?
Because in the whole of American history, no one has ever said of the U.S. Navy "Our purpose is peaceful exploration," and no captain of CVN-65 was ever heard using terms similar to "The Navy is not a military organization, its purpose is exploration."
IOW, Starfleet is -- and describes itself as -- an exploration fleet
that participates in war. That may seem weird relative to modern practices, but let's face it, that's hardly
the weirdest thing Star Trek has ever asked us to believe.
But really, how hard is it to consider that Starfleet during it's hundred plus years of operation be able to change as necessary from a military to a non-military organization as the need arises?
That's just it: since neither their mission role nor their command structure would actually be affected, the change is totally unnecessary. There's nothing in Federation law that says "the organization that participates in war" HAS to be a military organization. Starfleet probably never became a formal military organization because they were able to fulfill that role without actually changing their legal status.
We know for a fact that if the Federation got desperate enough they WOULD change it, and Starfleet would look very different afterwards (as we see in "Yesterday's Enterprise"). But even in the Dominion War, the Federation's simply never been that desperate.