It depends how much you overbuild. If you build enough to supply half your needed energy for the worst case week and 3/4 for the worst case month, 4 weeks is probably enough.
You continue building out local generating capacity until its maintenance cost less income from grid and synthetic fuel sales exceeds the cost of imported grid power and synthetic fuel imported. All the costs will be changing continuously. Generally, more generating capacity than you have will be reliably better for a long time.
After things begin to stabilize, you might decommission older installations or devote an increasing fraction of capacity to carbon sequestration.