The interplay of social identity and norm psychology in the evolution of human groups