I guess part of the reason is that, in the long run, you don't want to maintain the gas infrastructure for a whole city just to let people cook with gas.
The city will be maintaining the gas infrastructure for eternity. There will just be a subset of unfortunate residents that have to cook with electric while 99% of their neighbors continue with gas.
I'd expect that at some point in the next decade they will extend the ban to cover replacement appliances so as existing gas stoves and furnaces die they will be replaced with electric.
My fermi estimate is that every electrician in NYC would need to upgrade 1,750 apartments.
I can imagine it will be the same more or less everywhere at some point, including NYC. Sure, there might be a setback and the law might change, but given the plan to reduce emissions it seems kinda inevitable (again, in the long run).