Electrolysis does not emit CO2, unlike natural gas reforming. When a gas molecule is broken up, the carbon in the gas goes into the atmosphere, but when a water molecule is broken up using electricity, no CO2 is emitted because it does not contain any carbon.
Of course, it is an energy-intensive process from an electricity consumption standpoint, but natural gas reforming is also energy-intensive given the loss of energy contained in the natural gas. Only the hydrogen energy is recovered when a natural gas molecule is broken up.
I think it's a false argument to draw such a direct comparison between the two methods.