Current geopolitical events suggest that not only was reducing European reliance on fossil fuels sourced from the Middle East and Russia a good idea, but that they were not nearly aggressive enough in doing so. IIRC, gas heating still receives government subsidies in Germany that heat pumps do not (and have for more than a decade)
The transition away from oil will take a long, long time, and natural gas will be an essential component in renewable strategies for some time to come. But Europe needs to figure out how to reduce that consumption to not much more than what can be provided domestically and via trade with the US for geopolitical reasons.
Any cost comparison that doesn't factor in geopolitical concerns is incomplete.