There’s no law against helping a child with accidents FFS. Please don’t spread misinformation.
OP, the school should have a Continence Policy. Whilst it is unfair to expect teachers to toilet train children, accidents do happen and children of a young age will need help as and when it happens.
However, we are in an unprecedented situation at the moment and the school may have a policy re social distancing which prevented the teacher from giving hands on care. For example, if a child was choking or arrested of course there is a risk to life so the child would be aided physically but in a “minor” incident such as this which is unpleasant for the child, the risk to the staff member might be seen as greater in the current circumstances which might be why you were called to deal with this.
I do accept it was unpleasant and humiliating for your child but don’t go in all guns blazing, as much as you may want to. Ask for policies and facts and perhaps outline how you would hope future incidents would be dealt with. Hopefully this is a one off though.
When I was working with young children in an SEN setting where the policy was two adults to clean up a child and it wasn’t always possible straight away, parents were very helpful in helping their children to deal with continence problems fairly independently (for their own dignity mainly). They’d send their children in with a pack of wipes and a few pairs of pull ups as well as clean trousers. It might be a good idea, if this is a frequent occurrence to provide a little clean up pack and show dd how to use it as best as she can. Ok, her own attempt at clean up might not have been great as she’s only 4 but she might have been able to feel a little more comfortable and less upset in the space between the accident and you arriving.