Dogs are one the first animals to be tamed. Between 10,000 to 30,000 years ago, they were domesticated from a wolf-like ancestor. They were once violent predators; however, slowly, the first proto-dogs followed hunter-gatherers around Europe in hopes of eating their leftovers. Because of genetic variation, some dogs were more friendly than others to humans. As for the humans, the proto-dogs were very good guards and could sniff out potential prey for the hunters to hunt. This can be classified as mutualism, where two organisms received direct benefits from each other.
Most dogs were domesticated by the time humans developed agriculture about 10,000 years ago. Around the same time, dogs were buried alongside humans, indicating that people were affectionate towards dogs and considered them an important member of the family.
Of course, for dogs to have a relationship with humans, dogs like to read human emotions. Using eye-tracking equipment, scientists have found that dogs tend to look at the right side of human faces, where we express emotions more robustly. This fact gets even more interesting when scientists found that dogs do not show this "left gaze bias" when they look at other dogs or animals. This indicates that dogs have evolved to scan people's faces and recognize emotions.
On the other hand, there was an experiment lead by Eotvos Lorand University and Hungarian Academy of Sciences testing humans on their ability to classify dog barks. The human subjects were able to accurately read the dogs' emotional states just by hearing their barks.
In 2015, dogs were put into an experiment where they were presented with several scents: their owner's, a stranger's, a familiar dog's and an unfamiliar dog's. While the dogs were sniffing the scents, researchers measured the neural activity in the dogs' caudate nuclei, a section of the brain that indicated the "neural basis of romantic love." The caudate area was activated more by the owner's scent more than any other party's, demonstrating that dogs do feel affection for their owners. So, if you're a dog owner, do feel appreciated to have someone smell you with utmost devotion.