Your daughter is exhibiting self-soothing behavior, usually more pronounced when the child is tired or falling asleep. From the AAP's healthychildren.org page on common childhood habits:
Their repetitive nature suggests that they serve a soothing or calming process for the brain. Interestingly, even in adulthood many people cling to some of these self-comforting traits during times of stress: sucking on pencil tips or their fingers, pulling their earlobes, fingering their hair.
Since this is a tactile sensation, try to find a soft, silky replacement that your daughter can pull on, like a stuffed animal, a soft blanket, or a long soft-haired doll. I would wash it with your wife's shampoo/conditioner/whatever-your-wife-uses-on-her-hair and dry it before introducing it to your daughter.
With her mom's hair pulled back and out of reach, give her the toy to feel and encourage her to self-soothe on it. Model the behavior. She may not like it much and may cry, but keep trying until the habit is displaced from your wife to the object. Most likely, this will be successful; if it is not, eventually the habit will be broken, but it may take a number of tearful bedtimes.
If your hair is short, you might find it helpful to put her to bed with a book and her toy. If mom isn't there, she may take to the object more quickly. In any case, it will give your wife a break.