‘Keeping the kids at home’ can limit the persistence of contagious pathogens in social animals