You think "self defence" would be fair call when a dog is assaulted (touched) by anyone without permission. However back in the real world... best to fend off the kid before it gets near.
I had two kids ask if they could pat my dog, who was by then upside down - her usual greeting. The funny thing about this and it all went well, was dad and the kids were in their PJS - Sunday Morning and Dad had sent the kids out to get the newspaper from their driveway. And where we were - I could hear Dad but I couldn't see him and he couldn't see us. I got minor revenge by asking the kids if they were having pancakes for breakfast... Daddy - are we having pancakes for breakfast, can we have pancakes for breakfast.
An old blue heeler I used to live with - we'd put a wire muzzle on him and toddlers with no parents would try to put their fingers through the muzzle. I don't know what it is about some parents. No care and no responsibility, if something bad happens to their kid it's someone else's fault.