Oh my gosh! This sounds like MY life 9-10 years ago! Our oldest, now 11, had the very same problem. With him, though, we eventually figured out that because he loved his milk so much (even after going off the formula and drinking whole milk from a sippy), he just got constipated. From the time he turned a year old, he would only 'go poopy' every 3-5 days, and by the time he couldn't hold it, he was trotting back and forth, telling me to walk him around (walking helps with anyone, as you may have noticed) and holding my hands and SCREAMING til we were both crying! a few times, we even had to 'help it out' with a q-tip - which is not recommended and should be done VERY carefully! but when you are desperate to help relieve his pain, you will try anything. when we tried suppositories, they just usually came right back out and didn't have time to help. the doc helped me figure out that as much cheese as he loved to eat, and he refused almost every kind of veggie and not a fan of many fruits, that it was due to his milk intake and not enough fiber. also, the vitamin drops i was giving him in his milk had iron added, and that constipates! so i was doing this to my baby!
We cut out as much dairy as we could (he would not drink much juice or water, though) and started adding a children's version of Senokot liquid (not sure if they still make that) to his chocolate Ovaltine milk in the morning. It was kind of chocolate-y tasting so it blended in well. It really helped. He resisted the #2 part of potty training because he was used to being up and walking around to get it going. He had the hardest time just learning to sit down. We didn't like giving our kids anything medicinal long-term, but with this we just had to for a while. I think there are lots of herbal treatments you can try that are safe for kids, but what I have found is that with extreme symptoms, the herbal stuff just doesn't cut it quick enough. That stuff has to be a regimen and works more gradually most of the time. You may be able to find one that is more quick-acting. If you Google "children's laxative", you will find TONS of choices.
Another note - he is now almost 12 years old, and if he doesn't eat his Frosted Mini-Wheats EVERY single day, and eat a spinach salad once or twice a week, he still has a constipation problem. It may just be his body, or what foods he prefers, more than a mental thing, but it quickly becomes mental. Once when he was 4, he actually had something they can a rectal prolapse, where he felt the urge to poop so badly that he just kept pushing and he actually pushed his rectum outside of his body! It was horrifying, but when I called the pediatrician (of course, it was after hours!), he said to gently push it back in and not worry about it unless it kept happening.
And another note, my second son hated milk (except for mine) and loved juices, and even though we watered them way down, he started having "toddler diarrhea" at age 15 months til he was 3 and a half - he would have 7-8 dirty diapers a day and rashes to go along with them! I had a daughter born right at that time, and you can imagine how much fun all those diapers were! Amazing what moms will go through, huh?!
Best of luck, and I hope you find something that works for you and him!
A. V