@zarif I'm so sorry, my heart breaks for you. This is such a difficult decision to make.
As a mom, and the owner of a reactive dog, I always put my kids first. If my dog became too dangerous around my children, then I would get rid of him. I love my dog to bits and I would be devastated if we did have to rehome or BE him but my children's safety comes first.
Toddlers are EXTREMELY unpredictable. Even a well socialized dog can get nervous around a toddler, because they move so unpredictably, have no sense of personal space and grab things like ears, hair, tails etc. You do not want your dog to have even a close call with your kid. You would never forgive yourself.
Look -- you tried! You're not giving up easily -- you really put in the effort and you have a dog that sounds so anxious and miserable (maybe due to abuse, or previous living conditions, or just plain genetics). It's not your fault, and I think BE would be the humane thing to do for your whole family. If I were you, I'd maybe make a photo album to remember the good times and then cremate and bury his ashes with a tree or something like that.
I'm really sorry; this is a heartbreaking decision and it isn't easy. Good luck.