Does code require the gas line to be replaced when replacing a furnace?
Not necessarily.  Usually in these situations the existing infrastructure must be brought up to current code.   A licensed installer would not install the furnace without insuring that the supply and the exhaust were up to current standards.