Many dogs do what you're describing. Sometimes it's "protecting" their "person," and more often it's asserting themselves. I have many pets and have had many I've lost (natural death) over the years, and I can tell you that Yorkies are the biggest small dogs you'll ever run across. They have no concept of their size. It doesn't matter to them in the least. Our best friends have two large dogs (mixed breed), and one of my Yorkies chases them all around when we go for cookouts. (We take our dogs everwhere with us.) These sixty pound dogs RUN from her, and she weighs THREE POUNDS.
She still occasionally barks at other dogs when we're walking her. I don't think there's anyone in our neighborhood who doesn't have at least one dog, so there will always be someone else out with their dog. It was a battle to break her of that. At three months old, she would growl and bark and try to get at everything she saw, from cats to Poodles to German Shepherds. What worked for me was to point at her and do a very stern, "SHHHHH," when she did it. Yorkies are notoriously stubborn, but they do eventually get it. They're very, very people-oriented, and they want to please you more than they want to assert their personality. Just use some standard command when they're exhibiting unacceptable behavior so they realize that's what the command means, and never use that command otherwise.
Best wishes. Sounds like you have a strong-willed winner, and they're a lot of fun! They're just a little hard to convince about who's in charge