Of course Starfleet is the military. They're the people the government lets fire the guns in war.
Yes, technically Starfleet is the defensive force of the Federation, but its officers are primarily scientists and diplomats, not warriors. So it stands to reason that they'd be trained in a way that nurtured their individuality and self-respect rather than breaking them down psychologically with institutionalized bullying so they can be molded into obedient grunts. Indeed, not every military today uses such harsh tactics. Just because America does it, that doesn't automatically mean it's the right or the only way to do it.