This is where countries with some sort of mandatory service may have us beat. And maybe it explains why American policy was so focused after the big national wars. I don't think there's a better way to force camaraderie. But then it becomes Us vs Them on the other side of the border.
Yes, this works, as does joining a gym where you do some sort of group activity, say a BJJ or other combat sport.
The key with military is being forced to do something you hate alongside complete strangers with little opportunity to socialize outside of the group, under threat of court martial for leaving. And the group of strangers may change at any time. You really have to learn to get along, or work people you don't respect or hate.