Just like wolves selected for survival the humans who treated them well and eventually humans evolved to produce oxytocin on petting wolves =P