Op, I have only read your posts, and I think you are really going the extra mile to help this girl but I think that your situation regarding “custody” (I guess you are in the USA as there is no such thing as custody in the UK) it is far more simple than you may think.
Mother is not interested, there is no need to fight in court, or spend money on that, I doubt she will be arsed to fight anything when you are already paying her to see her DD. The only thing you need to do is to tell her you are switching routines, you have her on the week (in a school near you), she has her on the weekends. Simple, give it two months and DSD is living with you full time as she won’t be arsed (unless it affects her benefits if she get some).
I think it is fair to accept your OH is crap at parenting, won’t parent and can’t be trusted to deal with DSD’s emotional issues without emotionally abusing her himself (yes, he is neglecting her throughout the day and verbally abusing her when DSD needs comforting). You are not going to change him, so the option is leaving or staying with him. If you stay, you need to accept and embrace the idea that he puts a roof over your heads and you do all the parenting, there’s no point on fighting this, he doesn’t give a shit and may be keeping himself busier outdoors to avoid doing the parenting.
If you accept this situation then you would have more control about the situation at home, Honestly, nagging an uninterested parent to parent is far more tiring than doing the work your way, on your own, yourself... you are already doing it on your own, it is not fair, shouldn’t be like that, but if you are not leaving him, it is what it is. I’m sure you will feel less tired and stressed if you stop trying to get OH and ex to parent. If you don’t believe me, just pretend that girl had no parents but you, try it for a week or two and you will see the difference it makes to your wellbeing.
I think that the only way things will work for you while you are living with this man is to treat that girl as if she was your own DD, reassure her you love her all the time but don’t put up with any bad behaviour you would not tolerate from your own kids. I can assure you once she knows the rules and that they will be applied fairly no matter what, she will feel more settled, confident and content. Kids need structure and certainty to thrive. Having that structure will make parenting easier for you as well.
Talking about certainty, not knowing when, how or how much time she is going to spend with her mother must be really driving her crazy. But I would say it is not because she misses her but because she never knows what to expect. The kinder thing for your DD would be not to be told anything about when she is going to see her mother so she doesn’t get disappointed when the plans are thrown out of the window. If mum shows up is a bonus, a nice surprise.
We have hammered into us that contact with both parents is absolutely a priority no matter what. It is NOT if that is not on the child’s best interests. Being pushed to see a mum who actively makes her feel not wanted is far more damaging than not seeing her at all. I’m sure that if you didn’t have the distraction of having to insert two shit parents into your DSD’s life, DSD would be as nice and well behaved as your DD. She, as your DC only have YOU.