I think we have to stop understanding Starfleet as equivalent to
modern militaries.
Star Trek is basically "Hornblower in space". And if memory serves me, Age of Sail warships
did often have families on board (at least, captain and senior officers would sometimes take their families with them), and they definitely had prepubescent kids running around handling ammunition and similar. And they also did exploration, scientific missions and so on when they could (and if you watch Master and Commander, they have an actual biologist on board).
So to say that Starfleet is not military just because it doesn't feel like modern military is simply wrong. Even those not-a-military things you (
@jaime ) mention used to be purview of military at various points of time, and thus do not negate the idea of Starfleet being a military.
Starfleet flies around in warships. It has court martial. And when war breaks out, it drops everything else to fight and defend the Federation (science missions being treated as basically holidays for the crew to maintain morale).
It is a military.