The coevolution of cooperation and dispersal in social groups and its implications for the emergence of multicellularity