Look up “dog meets baby” on instagram. It’s an account with loads of useful information, dogs often don’t do this for no reason, there are always signs before a dog snaps. Please teach your children or others to not stroke the dog while he’s eating. It’s a very vulnerable time for a dog when they are eating and if hands come near they are likely to snap because they think food will be taken away, this could lead to resource guarding and unwanted aggression towards children. Please please research dog body language and teach children around you to respect the dogs space. If the dog is sleeping or eating NEVER touch the dog. Even if the dog is “ok” with the adults doing it, it’s different for children and dogs.
Also please don’t tell off your dog. It will only scare him and cause confusion
https://www.instagram.com/reel/DJZPQAyC95Y/?igsh=MTVneG94enk1ejBncg== I also recommend this page https://www.instagram.com/reel/DI4CLFcoPje/?igsh=MWNxMDc3NW1nZDN5eA==
https://www.instagram.com/reel/DI0grmlo8qL/?igsh=bWF6NndiMWt5eHRq
I agree with @Millie about not telling the dog off. It sounds like he's giving a good warning that he's not happy and you have to respect that. I shift my dog back in her bed if she's tired and a bit grumpy and everyone leaves her alone so that she knows that's her safe space. I'd suggest you stop allowing people to give him treats and create a space for him. Create this space before baby arrives and then let him dictate when he's ready to meet baby, direct him back to his area until things aren't new and be very positive so he knows he's doing good when he is x
I would take him to the vet as this can sometimes be a sign that there’s something wrong. For example, illness, injury etc. get him checked over. If it’s not that you might need to look into a behaviourist and try and think if something the child did could have triggered that reaction. Did they pinch him or pull his tail or ears? Obviously with a baby coming that needs to be assessed as babies aren’t always the most gentle at first. I hope it’s nothing serious and both dog and child are okay x