This does sound incredibly stressful. I'm glad your son is ok and I can relate to how overwhelmed and flustered you must have been. As others have said, perhaps your corgi was more aggressive than usual because he sensed you were nervous?

I know it's hard to find time (and money!) to get a dog trainer when you have a toddler at home, but that might be worth pursuing so you can keep your beloved dog.

Best wishes to you.