UPSes are designed to run for minutes not hours. I guess enough Megapacks to run overnight would be more expensive than gas generators.
The competition isn't the cost of generators, it's the cost of grid power, or the cost of operating gas generators every day.