How defense shapes the institutional organization of states