The latter offers better resiliency and lower transmission / distribution losses.
A well-insulated building and its hot-water tank are both (thermal) energy storage systems, that are more durable (and more affordable) than electrochemical batteries. A building can be pre-cooled or pre-heated when on-site solar is plentiful, to the end of the occupant's comfort range. This means a smaller on-site battery bank is needed to achieve year-around grid independence (for a conditioned / comfortable building).
It seems that we're just getting started with on-site flexible-load control, and building energy automation generally. The higher electric rates in some markets make it financially viable for end users today.