Wow, I think some people have forgotten what 2 yo are like.
This is a very young child, and a very old dog. That's not a good combination. If the dog is so elderly that his quality of life is minimal, I think having him put down would be the kindest thing all round. If he still have some oomph in him, maybe ask your mum to look after him till the end. The one you can't really do, as others have said, is leave the two sharing the same living space. Does your dog have a safe haven in your house (crate/ bed in cloakroom for example)?
It can take a very long time and a LOT of repetition to get the message across to some babies. My son was like this- he never seemed to learn from mistakes, even ones that meant he hurt himself. He was impulsive and prone to ignoring us entirely. He was also bordering on hyperactive. He had little empathy for anything, although he wasn't especially violent.
With a lot of patience (and sometimes not so much
) and a lot of repetition, and a great many years, he learned to be less impulsive and not to do things because they were a bad idea, rather than because he hadn't actually killed himself yet. He is now 19 and is a pretty model citizen tbh (2nd year engineering student, doesn't drink, doesn't do drugs, GSOH, generally nice person).
Hang in there, OP, deploy all the patience you can, make your boy gets as much exercise as possible (daily run in the park?), keep his mind stimulated, read to him as much as possible (stories about dogs since he seems to like them?), explain to him at every opportunity why he shouldn't hurt the doggy, show him how to treat the dog well (if you decide to keep him) and remove DS to a boring place the moment he looks like he might turn nasty, repeating ad nauseam that it is not OK to hurt the dog and he is not allowed anywhere near him if he's going to misbehave. Bringing up children is not a sprint, it's a marathon, and a flipping long one at that...