I think barking in the middle of the night is what early man found most valuable about dogs, that, and eating garbage.
Barking in the middle of the night saves the master's life when the intruder is dangerous.
Eating garbage prevents diseases from getting started or spreading.
It would be very hard to breed these traits out.
In earlier times the dogs were kept outside the village stockade.