I think it would be more to do with territory, competition for food and females. The animal instinct is to find food and shelter and safeguard it. So for these street dogs, roaming in a small group helps them to mark their territory and would take the intrusion of other dogs as a threat. The other may be the threat of the other males mating with females in the group. I'm not sure whether dogs live like a pack or a herd.