You don’t need to invest in the grid for that. You can use batteries. There are chemistries that work really well for large building batteries.
"Investing in the grid" means expanding capacity in order to meet increased electricity demands as electric vehicles replace fosil fuel vehicles and increasing switching and grid intelligence to better handle a more distributed supply and demand.
More solar + more batteries and thermal storage + better grid are all things that grow hand in hand.
Of course investment in the grid is required to meet large scale population demands.
But you can also invest in the grid and have excess energy shifted to other regions that can make use of it.