In 30 years of road riding I've never felt endangered as in your example with the pit bull.
If it ever happens and I could not go faster than the dog, this would be the time I would dismount, keep the bike between me and the dog and scream for help.
Other suggestions?
Scott