Untreated and neurotized insecurity makes one look for approval in the stupidest ways, and most harmful places. From the inside, however, the group pressure doesn't feel stupid. I guess.
Plus the military gets who they get; they can't offshore to India or try to poach talent in Croatia. So that means you get a right-wing nutjob from Kansas.
That said, doesn't mean the military didn't screw up a bunch. Chelsea Manning had a long list of disciplinary issues to include fist-fights with superiors, and by all accounts should have had a clearance revoked and/or been booted out of MI.
Also can't discount the power of bribes and/or propaganda. Russia and China have been going hard at right-wing sources with the goal of, among other things, stirring dissent and gaining a foothold in the military.