I'm extremely glad that the issue of out-of-control (or barely-under-control) dogs has been raised. I do a great deal of solo walking, mostly in Kent, and for me dogs are far-and-away the biggest problem I encounter. I've experienced snarling dogs, dogs jumping up at me, dogs running at me aggressively, and I've felt teeth twice (although without injury thank goodness!). I've 'had words' with owners who've been apologetic ("Sorry, he/she doesn't usually do that"), unapologetic ("Why don't you walk somewhere else?"), but most often they lovingly tell their pet to behave - and totally ignore me!
Of course, the overwhelming majority of dogs I meet are perfectly fine and have perfectly good owners, but I meet a great many dogs and so the problem is real and makes me treat them all with suspicion. The reason I encounter a lot of dogs is because I enjoy walking in forests and woods, and people tend to walk their dogs in woodland that's within about half-a-mile of a village or a woodland car park. In this situation, even poorly-behaved dogs are usually off-lead and I can encounter them with little or no warning. I hardly ever come across dogs on farmland or on hills, mountains or moors, although, having said that, one of my most worrying incidents was on a remote track on Harris when two (possibly feral) dogs followed me for about a mile trying to get to food in my rucksack (which I'd eaten, but presumably the smell remained).
But sadly, I have absolutely no answers. For a while I used to take a walking pole with me and hold it when in wooded areas or if dogs ahead looked dodgy, but I prefer to travel light... and in any case, I had a dog (on a lead) go for me as I passed ("Sorry, he's scared of anyone carrying a stick..."). I'm not going to avoid woods, but I do try to avoid areas where I'm likely to encounter dogs and if I see potential problems ahead I'm always ready to take an alternative route.
Just one more thing (if any dog-walkers are reading this, please take note!)... I walk briskly, so if there's a dog-walker ahead going the same way as me I'll inevitably catch them up and overtake. But it's rare for people to bother to look behind them and, as I approach, the dog knows I'm there well before the owner does. More than once, I've had dogs make threatening moves and the owner only belatedly realising they need to get their animal under control.
Phew - thanks for letting me get all that off my chest!