As a vet, owner of two dogs (one of which is fear aggressive, like the OP 's dog) and mum to two young children I feel pretty well qualified to answer this one.
Your dog has been trying to tell you that it's scared of the baby. If you'd noticed the head turns, the whites of the eyes, the ears held back, the yawning, the moving away, the tight closed mouth, you'd have got the message. You didn't though, you thought it was fine. So when the scary baby arrived in his face suddenly, he had to step it up a notch and snap.
Two things to note - if he'd meant to bite the baby he'd have bitten the baby. The snap isn't a bite that missed, it's a snap. Secondly, because nobody listened to his first, subtle messages he's learned that he has to use the big guns to make sure the baby stays away - hence the snarling and baring of teeth. He's saying 'I'm terrified of it, keep it away from me I'll be left with no option but to use these '. He's acting defensively.
You can remedy this situation. You do this by getting help to recognise his subtle cues, teaching him that baby=good stuff, and giving him a sanctuary where the baby never ever goes. You need to develop hard rules to ensure your baby is safe. You need to buy a crate to keep the baby out of the dog's space and a stairgate to keep the dog out of the baby's space. You need commitment, and more commitment, because there is a high level of risk which you will need to be diligent about managing. But this is very, very treatable.
Having said all that, I would never hold it against you if you decided to rehome. You have a lot to learn and this isn't the easiest time to be learning it.
Not a lost cause but you need to do some serious thinking.
Incidentally, my fearful dog is now very bonded with my 5 year old and is starting to develop a relationship with my two year old.