I agree you have a right to hike public trails. But by hiking these "public" lands you have to be willing to face the things that being in the public bring. If the "public" trail does not have a specific law stating "all dogs must be leashed" then you have to understand there is a certain risk you take by being on this "public" trail. The trail does belong to all of us, but not just one individual at a time. It belongs to the entire public, and that includes the public's pets.
But I do disagree that dogs are random as to whom they bite. I two have seen and heard of children attacked by dogs. While it is horrible and a tragedy, I will bet both the dog and the child did not have proper dog training. Anyone in the public who would bring an untrained dog onto a trail does deserve to face the consequences of doing so, up to have his animal put down. But I have to say again, I have never ran into a dog or dogs such as you speak of on the trail. And I find it awfully hard to believe that you were simply walking along the trail and some dog just came chasing you down from behind and attacked you.
I just finished a section here in Georgia and saw 3 dogs. Two were unleashed. One came running up to me as I met him and his owner on the trail. Now had my attitude been one where I thought every single running dog was an attacking dog, I would have taken a defensive stance, thus placing the dog on the defensive as well. But the dog came running up to me and laid down at my feet wanting to play.
It is all attitude and approach here. Much like the determining factors in whether you will finish and enjoy a PT-BMT-AT hike. Attitude and approach here, attitude and approach.