To check I understand you: the smaller tank with heatpump would consume less energy outside the time window in which energy is free than the large tank with resistive heating, but has a higher capital cost which would outweigh the amount saved on energy?
If that's right, it's not obvious to me that building a suitably sized solar panel is environmentally worse than building a heat pump.
The smaller tank with heatpump will consume a lot less energy than the larger tank with resistive heat.
Economically to me, the larger tank is cheaper, because the appliance is cheaper, and I never pay for the power it uses.
Environmentally, yes, it is not obvious. The large tank requires many more solar panels to power it but no battery. The small tank and heatpump needs much less solar but battery for nighttime use.
But it is weird, because for decades heat pump tech has been pushed as the environmental choice and there are still a number of government subsidies to invest in heat pump hot water systems. And maybe that no longer makes sense, with the money saved buying cheaper and less efficient devices spent on more solar deployments.