Yes, but ... A PV system is not accessible to many. We have a small 800W system in our garden, but for many the price or just getting permissions from their landlords makes a PV system unfeasible.
Also, if you are heating with solar you could heat water directly. But that path is also only available to house owners.
PV + heatpump maybe. PV + resistive heater yes. solar thermal is not worth price wise. solar thermal can be feasible only for big installations as is in stralsund, leipzig... - megawatts.
solar PV is order of magnitude cheaper in small systems (per actual provided output per year, not just rated wattage)
AND because hot water energy needs are much higher than for example tv, notebook etc, so after your hot water is heated, you can charge your devices with it, you can not do that with solar thermal. so if people size their systems for winter sunny day, they will have excess in summer so you can use that for other things like bikes, lawnmowers ...
of course there is ratio of people living in blocks of flats / townhouses and people living in family houses / rural, so every situation is unique. so townhouses should be connected to central heating network and heating network provider should chase efficiencies of scale, that is better, faster, cheaper for everyone ( europe / germany context ) if urban density does not allow otherwise.
similar situation with electric cars, a lot of people is crying that there are not enough chargers for them, those are "city" people, but in reality most people live in rural setting or family houses
and in germany every house already has more than enough electrical capacity to charge from outlet, you can charge car from 2.5kW which is same wattage as most electric kettles. yes it charges over night (10 hours) only 100 km but every house can do that already. faster charger can be bought. of course situation in cities is quite different, you can not just put extension cord from window. which is feasible in rural setting / family houses. even in berlin roughly 50 % of people do not live in townhouses / high rises.
Also, if you are heating with solar you could heat water directly. But that path is also only available to house owners.