Male cooperation for breeding opportunities contributes to the evolution of multilevel societies