I read a book on the history of dogs https://www.goodreads.com/en/book/show/40180044-once-a-wolf
The only thing I remember is he said dogs may have stuck around humans because, like wolves today do with others predators, they could follow them around and scavenge off their successful hunts. But it was also possible the wolves/dogs just really liked snacking in between meals. Wolves are very capable at finding their own food but they enjoyed some meat & bones thrown to them in between their daily rounds. That's what crossed the line between scavenging on the outside and a closer relationship.