I suppose it depends on how you look at it. Take solar, for example. On the one hand, you could argue that if your primary goal is to generate heat, you might as well use a solar thermal plant with lots of focusing mirrors over photovoltaics. The conversion to electricity first would inevitably be far less efficient.
On the other hand, if you’ve got your PV plants for electricity already but they are overproducing at times, there is the question of what to do with the excess power, and using it to run heat pumps may actually be a pretty efficient application at the point?
What about when you don’t have excess solar power? People need heat when they need heat, not just on sunny days. So, you’d need a massive battery for that, which has some undesirable implications. Instead, a thermal plant (be it solar, geothermal, or nuclear) can be designed to reliably satisfy heating and electricity demand with excess electricity going to hydrogen production for emissions-free steel, fertilizer, and vehicle fuel.