It's only going to get worse in conflicts where there's willingness to attack infrastructure because energy infrastructure is fixed in place, delicate, physically large and easy to detect and locate and vulnerable to even small drone-sized attacks, let alone missiles. And that's assuming you have to attack it physically at all and not just remotely disable it somehow.
If you have to harden the infrastructure, all you can do really is simplify hugely so you can repair it when attacked (fewer imported Infineon IGBTs, fancy Siemens PLCs, and networked UHVDC switchgear on 2 year lead times) and decentralise to minimise single points of failure and avoid cascading failures. Which is hugely inefficient in physical terms like wasted capacity and losses as well as the human effort required to keep it running, but some places might have some power.
Even then, in the next decades, against a state level adversary who could make and deliver, say, drones that can autonomously recognise and attack anything that looks like a ceramic insulator disk or a solar panel, if you can't threaten grave retaliation, you're back to the good old tutting about war crimes.