Behavior issues with Going number 2!

Mo
Question for mommies if you can help at all I would be grateful. My 6 year old daughter has dealt with constipation from the time she was a baby to present. She has been evaluated medically too. I feel this is a behavioral issue because of what she tells me. She told me today she had to go number 2, but didn't. I asked her why and her response was because my friends wanted to play so I didn't go. Consistantly, the cycle becomes she needs to go and has the urge, but ignores it because she wants to play with friends. By the time she goes she is backed up and constipated so it hurts. I have tried miralax, increased fiber intake, fiber gummies...etc. Also, reward charts, take away toys, and so on. Does anyone have ideas on what else I can try?