Earlier quoted context omitted.
Aren't there setups that can do both as well? i.e charge battery first and send excess to the grid?
The setups have to be separate (e.g. different outlets for mains and solar) to protect the grid. Even a small home solar installation puts out enough power to easily kill unsuspecting maintenance personell working on the grid, for example. So the utility company has to have 100% control over he mains at all time for safety reasons (i.e. your meter must never run backwards). If they cut the power (e.g. for maintenance…
This is controlled independently by the solar inverters's software, not the utility via any sort of signal. That software is mandated by regulation as you say for the safety of line workers. Recent batteries allow for an "islanding" mode, which allows continued backup power delivery to the house during a grid outage but cuts off the grid connection.
> your meter must never run backwards
... during a grid outage. During normal operation it's fine for it to run backwards. That's what net metering quantifies.
> said battery can either feed into the grid, or be connected to separate outlets in your house, but never both at the same time.
I think this is a technical limitation, since it would require a current divider and 2 inverters, which is a level of complexity not worth it for the application.