Welcome from another Ontariariarion.
I hate that in dogs. I think your last paragraph where you ask if it might be "not properly shown how to act around other dogs, not enough socialization, anxiety? jealousy?" hits good and possibly not exclusive reasons. My sister's last dog was like that. He'd be fine, even play happily with the other dog, till she went to pet it. Then he might attack it. He got used to my own dog and they became great friends and he did as well with Sis's good dog walking friends' dogs and I believe the often repeated contact with these dogs was most responsible. Sis would tell him what behaviour she expected of him too but she never trusted him with a strange dog.
If all you have to do is not pet a strange dog, as was my sister's case, then it's fairly easy, don't pet them. I'm sure some others will be along to give you more tips. I suspect, from the leash biting without you petting, that you might need more. I do suggest a training class in obedience so your dog learns in a controlled situation how to behave on leash with other dogs around. That training isn't exactly your situation but it will/shoud help her learn to look to you for direction instead of making her own decisions.
LOL, when I would visit Laddie with my own dog, even though they became best friends, he would try to push between me and her and block her from pets from me. He'd block me from my own dog. My sister's current dog will block my current dog from Sis's cat. It's kind of funny, like she is saying "That's MY cat and if any dog is going to harass this cat it will be ME." And the only dog Sis's will hump is mine and only when he was getting too much attention from their Grandma. Oh yeah, dogs can be jealous.