Maybe she would be happy if you put a baby monitor in her room so she had the comfort of knowing that you were watching over her. Maybe this is or isn't a great idea, I don't know, just a suggestion.
I agree that it is fine if her mom wants to sleep with her daughter many families do, when she comes to you ,you can do it your way and let her be in her own room she will get used to it.,unless she is very distressed, read her some stories then leave her room allowing her a hall light on and the door open if it distress s"her a lot then yes you will have to stay till she sleeps.
Are you sure that your ex-wife is encourging your daughter to sleep with her or is it that your daughter is scared at nightime and wants the comfort and security of her mother beside her while she is sleeping? Divorce is hard for children and children may need that extra comforting. I, myself, was a scared child at night. My mother slept with me many nights, because I was scared. I am glad that she was willing to, so that I could get a good nights sleep. If she would have not slept with me, I would have not slept. I would have been scared all night. I think it may be true that girls are more scared at night. I know our 9-year-old daugher (my step-daughter) is afraid to sleep alone at night. Fortunately, the girls (four) each share two bedrooms, which helps. Still, there are nights that we are up because she is scared comforting her. She has been going to a children of divorced families group at school for two years now. I think this helps when they have other children who have the same thoughts and feelings and are going through the same.