I know exactly how you feel! We went through the same thing with my dd since she was 2 (she is almost 6 now). We even held her from Kindy last year due to it.
We did Miralax for 2 years and while it did help her go, I wanted her to go on her own. We saw a pediatric gastro and she was diagnosed with "forced constipation" which is when the child had a issue going and then was afraid of going again. It was a nightmare! So many accidents, so many painful potty times. I felt so bad for her. I tried everything, from Miralax, going dairy free, prune juice, tons of Fiber, and many more. Finally we found out that Juicy Juice Apple Juice actually helped (or at least she started going to the bathroom with out issues and more than once a week) So now we have a strict "2 Juicy Juice box a day" rule at our house LOL. Within the past year she hasn't had any re-occurrence.
The Gasterologist suggested a book called "Why does it hurt when I poop." It's a pretty good book and helped her understand that she has to go potty to clean out her system. It wasn't a miracle book but it did help her understand why it was hurting to go to the bathroom and why we need to do it.
Good luck on the new meds! I hope she feels better!