Next time, she strokes his hair, without a physically intimidating maneuver, could always run your fingers through his hair, look at her, look at him, and say, yes, he does have nice hair.
Hold back the desire to completely konk her, and see, if that gets the 'hands off' message through, to the both of them! ((that's unacceptable, in my book, too))
As far, as repeating patterns in relationships, takes a lot of work on thyself, to get to the core route of it all. Combination childhood, friendships, here and now. How, long, is too long, for you to survive, solo?