> For the California three strikes law, am I correct in guessing all three strikes have to be in the state of California
The prior strikes don't have to be in California or under California law, but if they are convictions from another jurisdiction, the conviction must include all the elements of a California offense which would be countable as a prior strike (one that is classified as a “serious or violent felony”.)
The final strike must be a conviction under California law.
> If the former is true, is the optimal choice after 2 strikes to leave California permanently
Well, I suppose, but note that sonething like 23 other states and the Federal government have three strikes laws, too, and many of them (including the federal one) consider prior strikes from other jurisdictions.
And habitual criminals aren’t often warmly welcomed by foreign immigration authorities.