I would say the big mistake was to only use pipelines to Russia for gas. They should have built LNG terminals as redundancy. And maybe push for another pipeline to Algeria either through France and Spain or Austria/Switzerland and Italy.
They basically left the door open to abusive trade partners by not building any redundancy on such a critical resource. And it is not just electricity Germany needs gas for as it is also a very important resource for lots of industrial processes (and used for heating a lot but that should be replaced by heat air pumps)
Obviously such redundancy would have pushed up the price of gas in the short term at least. Easy to say this stuff in hindsight.