Your cat kneads your hair for the same reason that she needs your lap or any other part of you. It doesn’t really matter. You probably know why your cat kneads you. I’ll remind you if I may. It is because at that moment she is treating you as her mother and she is suckling at her mother’s nipple and she wants to speed up the flow of milk. I know it’s a bit crazy but it’s instinctive for a cat to do this and they do it into adulthood. It should be treated as a compliment by their human guardian who should respond sensitively and gently. It should not be abruptly stopped and neither should the cat be in any way reprimanded.
When a cat kneads your hair (I presume meaning on your head) it can be difficult to accept because it can be damned painful for the simple reason that there is not enough hair to protect your scalp and the claws go into it. What I would do is gently encourage your cat to remove themselves from the area of your head which will stop them kneading.
The key to the whole process is to be respectful of your darling cat because all she’s doing is indirectly telling you that she loves you and needs you and relates to you as an important Significant Other – SO. It is a charming practice.
It is possible to predict when this might happen. What I do is I make sure that I’m wearing thick enough clothing when I’m inside the home to allow my cat to knead my arm or lap without feeling it at all. Try and predict when it will occur. It is not all that difficult because cats do follow patterns and routines. Use that aspect of cat behaviour to work with your cat to allow her to express her natural instincts while avoiding being slightly hurt!
One of the great challenges for a cat owner is to allow your cat to maximise the expression of their innate instincts. This is what Jackson Galaxy calls Mojo. Or perhaps it is Raw Mojo. I’m not sure. It doesn’t matter. It’s about fitting in around your cat’s behaviour because we can do it and they can’t reciprocate because they can’t think rationally in this way. We are in charge. We create the environment and manage the relationship for better or worse. The unwritten contract is for the lifetime of the cat, a bit like marriage vows 😉 .