Trade is a great tool to mitigate and avoid conflicts like these, but the power balance was shifted too far into Russia’s favour here.
Energy policy should have included means of establishing sovereignty over energy sources. Shutting down nuclear reactors was probably not the best move. Russian gas was cheaper, until it wasn’t. In hindsight, keeping domestic sources available would have been wise.
Other policies to establish Russian economic dependence upon the West would have helped too. That said, only so much you can do with an autocrat.