My ds would withhold all day at nursery, reception and part of Y1. Ended up with bladder infection, and couple of soiling incidents when he just couldn't hold it. Also affected his concentration, as you can imagine being desperate to go to the loo would do.
In his case (he has HF autism) he was really anxious about the school toilets. He hated the smell and the noise (of flush, of the pipes, of other children) more than the process of actually going, as he was fine at home (after lots of work when much younger). It took a process of gradual acclimatisation to them, step-by-step, with rewards for every small step he'd take. Eg first his TA made the loo a 'fun' place (eg stickers on the wall), and just going into the loo = reward. Then spending 1 minute in there = reward. Then sitting on loo (with trousers on) = reward. Etc etc gradually building up to actually going. Then repeat process for flushing. The whole thing took months and months, and lots of patience from his TA and our team.
I wonder whether it's anxiety about the toilets with your ds too? Like yours, mine still avoids using the school loo for poo if he can, even now, and will go almost as soon as he gets home. His body has probably got into this rhythm now, so maybe because you went to the park rather than home this is why it happened?
Are school providing any support for him?
While you're waiting for assessment (from Child Development paed?) have they talked to you about applying for a statement? If there've been concerns since he was in pre-school I'd think this would be justified.