It doesn't matter what they wanted to do. What matters is what happened. As a result of their actions they got cut off. If Germany had invaded Ukraine (via Poland?) the gas might still be on. Of course we don't know that because other countries would likely take offense to that action and I'm not willing to predict how the world would change if they had. (I can't even imagine change would cause them to be willing to invade in the first place, much less how everyone else would respond.)
Politics often are about the unintended consequences. Often they are also unforeseen.
Germany joining the Russian invasion was never anything even remotely in the option space at all - utterly inconceivable in 2022. (Not aware of Russia seeking any such support there either.)
Ukraine would have blown up the pipeline anyway. And the land pipelines would have been cut off to Germany by the Eastern Europeans. So no, the gas would not still be flowing with a high probability. That's so absurd.
If Germany had gone to war Ukraine would be split between Germany and Russia now and the pipeline would be running. It is absurd to think there was any possibility of Germany going to war on Russia's side, but the result of them doing so is far easier to predict.
Of course if they had done that other countries would likely object and so we can go on and on with what could have been (for starters the propaganda would be all different). There are no easy answers and we can never know what would have happened.
Probably not directly invading, but there was a strong possibility of Germany supporting the Russian invasion, just as they're doing with the invasion of Iran.
I think what grandparent is very very fucking poorly trying to say is, Germany/EU could've accepted the "annexation" of Ukraine like it did Crimea in 2014. "Bad Putin! But what can we do."
Germany is in no position to go against the USA's geopolitical interests. Sure, they do trade shenanigans sometimes, like with Russian gas, but the relationship with Russia was pretty good before Putin decided to hold power endlessly - he even gave a speech (in German) in the parliament. But in the end of the day, those times are over; only extremist parties are pro-Russian, and Germany still has the 2nd largest US Army presence, including 15-20 US nuclear bombs parked here. It's unthinkable that any government here would go against "Western" interests and support Russia.
But which USA are you talking about? Currently it is ruled by such an extremist party where some members declared love for Putin (and others are cowardly just "following orders" because they like their power and paycheck).
The former Warsaw Pact countries are aware capitulating to Putin would mean they're next, so they're vocal against EU surrender. Further, if East Europe gets threatened, West Europe knows it'll have a mother of a refugee crisis - even if Ukraine falls they'll have one.
Anyway, that's all to say currently USA's geopolitical interest seems to be "Trump Tower Moscow", and Germany is not going to go along with that.
Politics often are about the unintended consequences. Often they are also unforeseen.