Yes, but there's little point in electrifying heating until you have a cleaner grid. Right now, the marginal source of power in Germany is coal and in the UK is mostly gas (occasionally coal). If you switch your heating to electric heating, that's how the electricity would be generated. With gas as the marginal source, if you switch from a modern condensing gas boiler to an air-source heat pump with a COP of 2.5, you might come out a little ahead in CO2 emmisions once you factor in generation (50% thermal efficiency) and transmission (9% losses for the UK) losses, but not a lot. With coal as the marginal source, you come out behind in CO2 emissions from switching from gas heating to a heat pump. If you switched from gas to resistive heating, it's a lose all round.
> but there's little point in electrifying heating until you have a cleaner grid
That's not true. Both endeavours are long - if you wait to start electrifying heating until the grid is fully decarbonised, you'll be waiting for a decade before starting another decade-long thing. If both are done in parallel it sill, of course, be much faster.
I guess you're talking about as a country. But as an individual in the UK, I'm better to wait. Switching now doesn't help CO2 emissions and sometimes hurts, prices will likely be lower in future as production scales up, I can invest the money in the meantime, and I can get a brand new heat pump at the point it actually does help. Instead I've focussed now on better insulation.
If you are in Germany or the UK, you would expect a COP of around 4 from a serious system. Or at least, COP4 is what we expect in the Netherlands, and the climate is not that different. COP 2.5 is a sign of a poor setup.
We don't have time to do things one after another, we have to switch heating, transport and most everything else to electric while simultaneously improving electricity generation.