Yes, but if you need to have all that infrastructure anyway it no longer makes sense to compare the cost of solar+batteries with the cost of fossil fuels because you actually need to have
both.
If you compare the total cost of solar with just the fuel cost of fossil fuels (ignoring its CapEx and non-fuel OpEx) that swings the equation a lot.