It seems my kid once had a bout of severe constipation, which apparently hurt him and made him dread pooping lol. I found myself putting him in a warm bath until he finally pooped in the tub, and then I noticed that the pain seemed to ease. After that, I tried shifting to a routine where e would tell me when he felt the urge while in the tub, and I would quickly move him over. Once he got used to using the toilet, I would wait until he mentioned needing to poop outside of the bath, then sit him on the toilet until he went. We ended up spending almost an hour there, with him screaming and me gently putting him back each time he got up, until fatigue seemed to help him finally poop. It appeared to become easier each time as he realized it wasn’t that bad. Now, at about 3.5 years old, he seems to go and poop and pee on his own, and he simply calls me when he’s finished so I can help him wipe.