My point was that humans had domesticated dogs (15-50,000yrs ago) a long long time before the domestication of livestock such as sheep (9-7,000yrs) and cattle (8,000yrs). It is much easier to farm grain and cereals than it is to farm livestock as livestock require enclosures and as you say, will be hunted so ealry man grew grain and crops. The availablilty of free hand outs to vermin would have attracted them in droves and the predators will always follow the prey.
A dog that is brought up around a herd will protect that herd in some way be it through barking or other methods, hence why hill