There was a study on urban rats in New York where there is a growing genetic difference between certain rat populations based on their respective niches. If dogs are believed to be commensals, it might make logical sense that a genetic drift likely occurred among wolves and dogs to some extent. In the sense you have wolves habituated to humans through waste (given toilets were practically nonexistent before, there would’ve been a lot of public defecation and logically wolves munching on those) and wolves who remain wary of humans.
Logically, there was a Russian study on the niches stray dogs occupied but also depending on the degree of socialisation to humans. First, you have owned dogs roaming at will (this includes dogs living on farms, gardens and open compounds). Second you have truly stray dogs who’re somewhat habituated to humans but remain suspicious of them. Then there are the truly feral dogs who remain invisible most of the time.
If it sounds strange to say dogs have more in common with rats than they would with sheep, fancy rats do exist and both dogs (especially beagles, horribly enough) and rats are used in experiments to varying degrees of controversy. Dog and rat meat do exist in some parts of the world but bear in mind even within those places not all people necessarily eat those.
Also both rats and dogs can live outside, especially in the garden. Actually some people still make their dogs stay outside for reasons like guarding and also to minimise indoor filth (I know this from experience). The filth thing’s partly why other people don’t eat rats and dogs. It’s not just due to sentimental attachment but also hygienic caution.
(It would be like eating poop really.)
Some people do insist on making others clean themselves after touching dogs (or any dirty animal) that the comparison between dogs and rats become clearer. Another one’s that at some point in Europe, some people were made to kill stray dogs (which’s arguably still the case to some extent). As horrible as it sounds, dogs are definitely commensal.
The fact that some scientists think dogs are adapted to pariah lifestyles makes sense if it weren’t for cultural attitudes on the basis that dogs are dirty that even if owned, the commensal lifestyle’s inevitable. Especially if they’re often outside and fed scraps. Circumstances like lacking certain resources and being in a remote place would be enough to have dogs be adjusted to a commensal lifestyle.
(Based on what I’ve read, some of those stray dogs in Europe come from farms which more or less proves my point right.)