I'm not sure what other country or bloc would ever accept the national security concept of "we can cut you off from energy at any time, to keep you aligned against that other guy" as something they're supposed to support.
Meanwhile the pipelines existed and can be configured to work the other direction, so the somewhat friendly relations at the time between Germany and russia could have secured gas supplies for Poland and Ukraine.
So "we'll cut you off when we want", "you're evil anyway" and "hey, don't bypass us", all at the same time. No, thanks.
That said, the "moral high ground" solution would have been to get rid of fossils earlier - which wasn't much of a talking point by the objectors to Nord Stream 2, except for the Green party.
Of course, Poland and Ukraine would have lost their leverage that way as well, while Germany would have lost the lever of economic relations with russia, so that option might have been even more fragile for Eastern Europe.