If he was a synth spy.
Stick with me here. Dogmeat doesn't make much sense as a character. He instantly follows you, is perfectly loyal, and can understand any command given to him. These are all unusual, especially the part about him being instantly loyal. Dogmeat is clearly trained to kill, and attack dogs like them don't trust strangers easily. On top of all that, there is the fact that he is the only dog in the wasteland unaffected by radiation. Things about him just don't add up. Unless of course, it was all an institute set up.
The Institute was known to plant synths into positions of power. The institute was researching how to create other creatures, not just humans. The institute needed a way to keep tabs on someone as important as you, and who would suspect their loyal pet dog? It explains everything, and fits perfectly with the established facts. What do you guys think?