When your power grid management interfaces are directly connected to the Internet you must suffer. There's no excuse for that.
Not saying it necessarily was in this case, but if such a connection is justified, then there's no excuse for not mitigating that risk properly with an applicable security model.
The answer is risk mitigation and management. If we unplugged everything that got hacked, nothing would be online.
And WHY do you need the power grid online in the first place?
About the only reason can imagine you'd use the internet in a system designed for controlling the power grid is as a backup communications path for all those remote sites when your primary data path fails. However, you are an idiot if you don't use encrypted VPN's and some pretty restrictive firewalls in those cases.