Gene Rodenberry spent years telling everyone and anyone that "Starfleet isn't the military!". He even had militaristic jargon cut from novels.
Clearly he was wrong, but it's easy enough to believe the pseudo-military of the future operates on differing principles to the armies of today.
Today's armies break people down and rebuild them all the identically. Star Trek's future is different - it embraces people's differences as strengths. The TOS crew weren't G.I. Joes, nor have any Trek crews ever been.