The only to never be successfully hacked is to never be hacked.
Just like home security. You can be as careful as you like, security lights, dogs, alarms, whatever, but if someone really wants in, boom.
Stuff like this happening and getting hacked is like someone driving through your neighborhood with a garage door opener and smashing the button by every house. If your door opens… oh well.