Explaining cooperative groups via social niche construction