The domestication of dogs is possibly the first and most important technological advancements of early humans! The oldest known archeological finding dates to 12,000 B.C.E. to the temple Gobekli-Tepe located in Turkey. Additional evidence, the Natufian grave located in Ein Mallaha, Israel carbon dates to 12,000 B.C.E.
The true origin of dogs is not clear in date, place or purpose. Many Historians Archaeologists and Ethologists believe that mans best friend was domesticated tens of thousands of years ago. But some believe that man and dogs history is much deeper than this. Possibly dating to when our ancestors adopted the life style of the Nomads at the beginning of the last ice age approximately 100,000 years ago.
So the wolves adopted the trait of scavenging for the food left over by human migrators.
But even this theory still leads to selective breeding through survival of the friendliest. I expect that the wolves who where less afraid of humans would be able to stay closer to humans and their camps. Wolves who stayed closer had a higher chance of getting the left overs compared to the ones who didn't. The ones who did would of had a much higher chance of survival compared to the ones who had to hunt for their food. Meaning the scavengers had a higher chance of survival and could pass their genetic traits down to their offspring. Eventually leading to a animal that was not afraid of humans but seen them as a source of food.