I’m assuming old multi story houses with gas heating typically use a water system (radiators) and only a single basement furnace? In that situation, switching the boiler to anything else or even better just using central heating should be a reasonably sized investment.
It’s not like German cities are unique in how they are built and heated. Lots of other cities have done this conversion in the latest decades.
Gas infrastructure was old and established in all major European cities. Now it’s electrical stoves and central heating in many places.