I’ve got a relative who owns a small farm. He’s got lots of cats running around, and he loves them. It’s because the cats keep the mice in check. No cats equals mice in the cow barn, and mice in the corn bin.
Some ancient studies believe that the ancestors of today's felix domesticus came down from the hills and ingratiated themselves to former hunter gatherers turned farmers by keeping the mice out of their grain storage.
Dogs became man's best friend perhaps at the hunter-gatherer stage by assisting him on the hunt. They were initially beasts of burden and a source of food.