I'm not going to label your son a bully without more details, but I can imagine that B feels that your son is just yet another kid who treats him badly. Your son is ostracising him and when he engages in this kind of thing (running away when B approaches) as part of a group, then it becomes even worse. This behaviour is unkind and unacceptable. If this were my child I would be addressing it very quickly and stamping it out.
I have a zero tolerance approach to stuff like this, actually because of a child who sounds eerily similar to B in your story. The child (let's call him J) that I knew was in my class at primary school. He was good natured but quirky (to use your term), and viewed as annoying by many. He suffered the exact kind of ostracism you are describing. My family moved away but we kept in touch with friends which is how I know the rest of the story. When J moved up to secondary school, he struggled more than ever because there were kids from other primaries who didn't know him and were even less inclined to put up with him or actually get to know him at all. Eventually there were kids who actively severely bullied him (telling him to kill himself, physically assaulting him etc), then the vast majority who did things like exclude him and refuse to socialise with him, then just a couple of proper friends. Eventually, when he was just 13 years old, J killed himself at home. He was a very talented musician, an extremely clever boy, and most of all he had a good heart.
Although everyone likes to point the finger squarely at the kids who hit and kick, call names, play vicious tricks etc, I think the ones who support the bullying by going along with the ostracism and isolation of the victim play just as big a role. Maybe J could have endured a few bullies if he didn't also feel like 99% of his peers thought he wasn't worth even speaking to. Who knows.
Your son and his friends aren't obliged to put up with being screamed at, hugged against their will or any other intrusive behaviours. But they are old enough to understand that some people require patience and understanding. That when someone is struggling to fit in, the kind thing is to help them. They should also be old enough to understand that sometimes when people feel left out, disliked, unhappy or are suffering from low self-esteem, they can behave in strange ways as they desperately attempt to find some way to relate to people. Your son could explain to B that he doesn't like the shouting/hugging etc but that he'd love for B to join in with their game of X, Y, Z if he can knock those things on the head. I would expect my child to approach this with kindness and compassion, because those are extremely important values.