Just take Kirk's comment to John Christopher literally "we're a combined service" (IIRC).
Starfleet is a multipurpose organization whose military functions come to the fore when needed but otherwise recede into the background when other duties arise. It's not really all that complicated a concept.
And this is the problem with the military/non-military argument.
If we take Kirk literally at his word from TOS then he is:-
A decorated soldier in a military or combined service commanding an Earth or Federation ship working for the UESPA or Starfleet or Federation defending the well-established borders against enemy aggression while conducting a peaceful exploration mission of completely unknown and unexplored space.
Even in TOS it was all self-contradictory, but by TNG when Roddenberry had decided "military=bad", it was impossible.
He was initially fine with Franz Joseph including purely military vessels (destroyers and dreadnoughts), until later.
As to modern Starfleet "not building warships" that's a bit incorrect.
Of course, during times of peace their vessels are multi-role, such as the Galaxy, Excelsior, Constellation etc.
After Wolf 359 we start seeing the smaller, more military craft, and no mention of families on starships for the long-term exploration missions, unless of course anyone can argue that the Akira's 15 torpedo launchers is standard for an exploration vessel?
From Sisko's description of the Defiant though, there could even be speculation that all the non-military stuff spouted by Starfleet is just PR BS!
"Officially, she's an escort..."
But one line regarding one ship doesn't make that speculation concrete proof!