It's certainly possible to have a solar installation that does let you disconnect from the grid, but it requires extra hardware (including a battery backup).
To become grid-independent adds substantial expense. Having your own battery adds another $10-20k, along with whatever costs are associated with switching the grid.
Also, being off-grid is actually illegal in some places.
Governments want utilities to continue working at reasonable prices, so they regulate utilities heavily. In exchange, utilities get protection against competition. This is true in many countries.
Specifically around solar, there's a concept called "utility death spiral" where more and more people opt out of the grid, causing the grid to be unmaintainably expensive. This the dream that solar conpanies tell their investors.
Power companies would of course want protection from the utility death spiral, and can often get it.
Disconnection isn't always illegal. Another form this can take is "all houses have to pay a grid fee, whether or not they are connected".
Then again, we regularly have huge rolling blackouts here so we need the inverter to be a giant UPS for the house and be able to use solar and grid at the same time.