I had a full-size Collie once that I didn't train anything along these lines, just Basic Obedience. He was the sweetest thing (neutered) and loved everybody. We had people in and out of our house all the time and he was everybody's friend. Then one day my two small children were playing outside and a gentleman who had been to our house many times came over to use the phone, a common occurrence. Afterward he saw the children playing and took a step toward them to see what they were doing. To my great surprise this sweet Collie, who knew him well, and who had been lying beside the children, stood up and placed himself in front of the kids, between them and the man. There was nothing threatening or unfriendly about the dog's demeanor, his tail was wagging slightly and he had a pleasant expression on his face. But the man stopped himself and said, "I don't think I'll go any closer," thanked me for the use of the phone, and left.
I had a Golden retriever that protected me on three separate occasions. He was extremely sociable and socialized, and went with me everywhere. I wouldn't have the slightest notion how to teach protection. But he knew when I was in danger, and he took care of it. I may be wrong, but it's my belief that dogs instinctively protect what they value.