Developmental plasticity and social specialization in cooperative societies