Cooperation maximizes biodiversity