Yep. But there is a caveat - hydrogen from Russia is much easier to replace with hydrogen from another source, because hydrogen is one of the most widespread chemical elements on Earth.
Natural gas isn't scarce. It's still very cheap in many countries. Transportation is what gets you, and hydrogen would be no different even if it would be abundent somewhere (which it isn't).
In this case, Germany has no reasonable alternatives other than to receive energy from Russia, or to start generating hydrogen on its own.