My husband did this as a child, he would bang his head in the crib until he fell asleep, his mom took him to multiple Doctors trying to find out what was wrong and why he was ~possessed~ but it turns out it is simply just a self soothing mechanism. It helps him fall asleep and get him comfortable so he just bangs and bangs away. He also did this into adulthood with his college roommates when he shared a room they were like wtf? When he would bang his head into his pillow to go to sleep. Now that we’re married and have been together almost 15 years, he doesn’t do it anymore because he is comfortable. My only advice (which doesn’t seem reasonable for you at this point) would be to give her her own space maybe connected to your bed but not in your bed, otherwise i don’t have any advice but this is normal. Hang in there!!!
maybe time to stop co-sleeping if it bothers you so much otherwise you kinda just gotta deal w it lol
My oldest daughter used to do this. What I started doing was basically patting/ rocking her butt. It kept her from actually moving which calmed her down quicker. She stayed awake longer because her movement was comforting but she couldn’t stop what was comforting her. Hopefully this makes sense