There is no law that says that you must use gas for heat. But once you have that installed base, you can’t just switch from gas to electric heat overnight. It will take decades to make that change. Even if all of the equipment was available (and it’s not), it would take a team of 3-5 workers 2-3 days to convert each home. And that’s assuming a simpler gas -> electric boiler swap without needing to upgrade electrical service panels/etc. This type of change can get complicated quickly for just a single house. Multi unit homes would be more complex. Now factor that over all other homes/buildings and you can see that the number of workers required to do this rapidly don’t exist.
Even in the US, there is a push to phase out gas heat in many locations. But it’s a phased rollout with a plan decades long.
Could this be a longer term plan? Definitely. But with a quick turnaround? Not really.