Your dog may prefer rare steak to cake but his stomach is actually suited for the latter as well. Farming introduction made dogs eat as much wheat and millet that they evolved extra copies of starch-digesting genes about 7.000 years ago. That helped them stay on our side even though life conditions changed.
Dogs evolved from wolves 11.000 years ago somewhere in Eurasia. One of the major changes in canine genotype were additional copies of amylase, a protein that starts the breakdown of starch in the intestine. While wolves have one copy on each chromosome, dogs may have 4-30 of them.
Morgane Ollivier from Ecole Normale Supéieure de Lyon together with Erik Axelsson from Uppsala University investigated the issue. "This expansion [in amylase copies - MK] reflects a local adaptation that allowed dogs to thrive on a starch rich diet, especially within early farming societies, and suggests a biocultural coevolution of dog genes and human culture" they write in Royal Society Open Science journal. Dogs, which at that time were already domesticated, learned to eat whatever people discarded. Because lot of leftovers were rich in starch, major nutritient in grains, they developed a different diet-related genes. Next time a dog looks at your cake with envy, you'll know why.
Source: Science, Heredity, Royal Society Open Science. Image: ASPCA