Combine it with rooftop solar to get the equivalent of free fuel for your generator every time the sun shines.
That is the key—having enough battery to cover an extended outage is very expensive.
My generator can run on natural gas, which is piped to our house and only had one outage in the fourteen years we've lived there (when the gas company replaced lines as part of preventative maintenance). So effectively, we have a redundant electricity source coming into the house. If that was also down, I could also run it on propane or gasoline.
That being said, if I had to pick batteries _or_ a generator, I'd prioritize batteries. We have both, and the batteries cover the majority of outages, while also providing other benefits.
If you cannot install residential solar, don't have enough solar, or have to defend against outages lasting for days or weeks, having the infra available to support an exterior fossil generator is certainly something to consider (main load center transfer switch, receptacle on structure exterior for genset supply to the load center or a subpanel of critical loads).
[1] https://www.basepowercompany.com/ (no affiliation, I just like batteries!)