There are many, many theories and timelines that seek to explain the process by which early humans domesticated dogs. My favorite suggests that humans and canids co-evolved, each conferring a selective advantage to the other. This article goes so far to theorize that opportunistic photo-dogs domesticated us to improve their odds of survival.
Also fascinating is is this rather lengthy research summary (PDF: Co-evolution of Humans and Canids) that notes the parallels between wolf/dog pack behavior and human moral systems that regulate the behavior of members of the social group. What if we learned some of what makes us human through our relationship with dogs?
In other words, what if the humans who affiliated with their animals, who were predisposed to form connections with dogs, who looked into their eyes and saw an affiliation - what if those traits conferred a selective advantage? The dog-lovers would have thrived over those humans who had no interest in such connections. We might be hard-wired to love our companions, bonded to them through more than just culture and history, but through our DNA. We might owe them one of the essential qualities of our humanity, the willingness to feel compassion for beings who are unlike us.