You can certainly try distracting him, but expect mixed results, because one of the hallmarks of a gifted kid is the ability to remain focused.

For the behavior of pushing a parent away when she was trying to do something dangerous and we were trying to intervene, my DD got a warning, and then a timeout, beginning around 6 mos of age. I get funny looks from other parents when I say that, because they just don't get how a kid that young could possibly connect action and consequence. But she could. She could also process an age-appropriate explanation of why what she had been doing was a bad idea, once the tantrum passed.

The end result was that her "terrible twos" weren't terrible at all, and were in fact quite delightful, because rather than spend the first two years of her life teaching her that fussy behavior was an effective tool to get what she wants, only to see rules inexplicably changed, she learned more constructive behaviors instead.