My mother-in-law was a lovely, sensible woman but she did irritate me in one specific way, particularly at the beginning of our relationship. I'd tell her about something and then she'd ask me to tell her about that very thing! Eventually, I realised that was just something she did. I accepted it, relaxed about it, expected it and was much happier simply repeating what I'd just said. Occasionally, she'd realise and say, "Oh Liz, I'm sorry! You just told me that, didn't you?"
Maybe I'm boring and she just switched off. Maybe I have a soothing voice and she switched off to it. Whatever! As I got older, I became more patient.
Anyway, there might be aspects of your mother-in-law's behaviour that you can convince yourself to accept and relax about. I'd go along with others' suggestions about not responding to texts. The hair stroking, however, would make me cringe! I don't like my hair or face being stroked. You could put your hair up, if it's long, or cover it with a scarf or cap or use a hair masque and leave it on when she visits.
Of course you could just lay down some ground rules with a smile e.g. Two hug rule: arriving and leaving. You could explain that too much physical affection from anyone, not just her, makes you uncomfortable.