STOP the medication, that is ridiculous. Your pediatrician should know that. The only thing I'd be concerned about is to rule out a UTI.
He is 3. He has better things to do than to stop and go to the bathroom. It is perfectly normal. It is a developmental leap. Even if it is Frustrating.
Help him by escorting him to the bathroom every 1 1/2 hours or so. Even (especially) if he says he does not have to. A 3 yo (or 4 1/2 yo for that matter) can not be trusted to accurately tell you if they need to pee.
My 4 1/2 yo has the occasional accident if she is really busy with play. She potty Trained herself at 17 months.
Don't scold him. He is not doing it to irritate you. He may wet the bed at night for several years. Dont scold him. He's not doing it on purpose. Some little bladders take a long time to develop. He's normal. That's what pull-ups are for.
Please keep in mid any medication you give him will compromise his liver.
Hang in there & remember it will not last forever. Keep changes of clothes handy & help by reminding him.
P. : )