I wonder if a less efficient desalination plant would be cheaper. The modern efficient plants use RO with pressure exchangers, I think. Maybe a flash distillation plant or an RO plant without pressure exchangers would be economical to operate intermittently.
But desalination may be a poor example in general. It’s not actually very energy intensive, at least compared to the value of potable water in an urban location.