It's to decrease reliance on Russian gas. If Germany is almost entirely reliant on Russian gas then they cannot impose serious sanctions on Russia without Russia shutting down the gas supply.
Even 2009 at the former height of the Ukraine Gas dispute, exports only got a little disrupted, mostly to Ukraine itself.