From what I can tell the pitbull in the 2nd event acted the same way as the pitbull in the first event. And at the way it was growling, I could only assume it was going to attack as I never seen a dog acting like that if it wanted to play.
Hard to say really. Pit bulls in general are very vocal dogs and make growly, yelpy, whiny, etc noises for play or to get attention and such. When my dog and my recently adopted-out foster pit/lab mix would play in the backyard, I was surprised none of my neighbors showed up concerned. The growling and noises were LOUD. It also
looked a little violent if one was not used to a)those dogs and b)dog body language. If the owner was truly surprised, then my guess is that it was not a dog-aggressive dog and the owner was more surprised by your reaction than by the dog's actions.
Dogs do slip their collars and leashes, even from responsible owners, so that is also a possible part of that equation.
I think you are justified in using REASONABLE force to protect your dog. I would however caution you on a few things-
One is that San Francisco and the Bay area in general have some of the strongest laws on weapons. I don't just mean guns, I mean weapons including stun guns, pepper spray etc. So before you carry anything tougher than a large Maglite (which is actually a great weapon if need be), find the law in writing that allows you to carry that item.
Also think of things to scare off a dog without permanently hurting them- air horns, water, pepper spray if legal, maybe vinegar but never ammonia or anything that could cause eye damage etc. I'd be pretty pissed if you permanently injured my dog when the worst my dog was going was rushing up to play (slipping a leash for example)
Two is learn dog body language. You want to use the minimum amount of force needed- I've had dogs rush me and my dogs before who were scared off enough with just shouting and a strong body posture. Those were mildly aggressive dogs, mainly being territorial. But I've had other dogs rush us just wanting to play. I simply held my dog behind me and shooed the dog away.
I had a previous foster pit bull slip her collar. It popped open and she darted for a big lab. She was 100% looking to play with that lab. The half dozen people walking with me on the hike agreed she was trying to play. She was bouncing around, open mouthed but never biting down, etc. all the signs of playing. The lab's owner freaked out and thought my pb was trying to kill her lab (who was very happily playing along). I really felt sorry for her panic, but I was doing my best to hold my other dog and grab the little loose one and she was simply screaming. Had she recognized the dogs' body language better like the other people around us, things would have been much smoother and less stressful. I'm not directly equating this to your experiences, simply showing the benefit of understanding different breed's play styles and such.