Encopresis in 3.5 year old?

k

Hello everyone! I need tips and tricks and advice because I'm just worn down. My son is 3.5 years old and has been pee potty trained for a year. Poop has been a struggle. Then, in the last 4 months he's become encopretic. He's afraid to poop to where he's holding it in intentionally no matter what we do.

His doctor started us on a half cap full of miralax daily as well as a high fiber diet but he still is withholding poop. I can tell he has to go because he'll shiver and get goosebumps and tense his shoulders up but he just won't go when we sit on the potty.

He asked for undies (he's walking around naked currently) because I know he wants to poop in his undies which obviously I'm trying to sway. Any advice? Anyone deal with this?

I'm beating myself up thinking I've gone wrong somewhere to cause this and it's really hard. Any advice I'd appreciated.