It’s not luck, though, right? They are man-made; selectively bred to cooperate with and have affection for humans.
I figure dogs were pretty impressed with our take-downs and were glad to share the spoils, and vice versa. Throw in a warm fire and you got yourself a friend.
[1] https://en.wikipedia.org/wiki/Wolves_as_pets_and_working_ani...
in the sense of domesticating meaning training, I wouldn't call what you can do with a wolf "perfect". Don't leave the baby alone with them.
Tail-wagging in juvenile wolves and foxes was selected for in adult dogs. Their acutely sensitive hearing and olfactory sense complements our eyes etc.