Your analysis completely ignores the capital costs associated with building out a variable demand system. Every battery built will tie up a certain amount of money into fixing grid pricing variability, as well as depreciate in value and usefulness over time.
If electric overproduction is an infrequent enough condition, it may well be cheaper to waste energy than to build a battery that just sits there 300+ days a year doing nothing.
It doesn't ignore it but the premise of capital cost is that it then gives you access to potential gains. That breaks down if you are dependent on selling to a monopolist that sets prices based on their own needs rather than the market needs. In this case, local energy providers get protective about their more costly infrastructure when faced with homeowners supplying cheaper energy to the point where they charge negatively.
Right now the power market is weird because people are deliberately installing less solar than they need/want because their local energy providers are simply refusing to buy the excess energy beyond a certain number of kwh. And since they are the only party you could feasibly sell to, a lot of homeowners simply install less capacity.
Think about it, you've got engineers on the roof to install solar panels, wires, inverters, etc. and the panel cost is only a small portion of the overall cost. Why would you cap your installation at 4kwh when your needs are closer to 10 kwh and you have room for 20 kwh? That's exactly what's happening in a lot of places.
Capital cost vs. captial gains is what normally dictates these things except we are talking about effective monpolies where the monopolist is protecting their prior investments and can choose to deny access to the market for everyone else. It's basically forcing consumers to help them turn a good ROI on already obsolete investments that should rightfully be killed ASAP otherwise.
If electric overproduction is an infrequent enough condition, it may well be cheaper to waste energy than to build a battery that just sits there 300+ days a year doing nothing.