I think this should be in pre-1900 but regardless, here is my idea:
William Gwin and Milton Latham remain in power, allowing California and Oregon to secede as the
Pacific Republic during the civil war. The Pacific Republic gains it's independence in a war that causes the nation to devolve into different competing republics and confederacy, like Deseret and the Central Confederacy. However, discontent with the new aristocracy and the gross policies of enslaving negro immigrants and coolies by the elites quickly turns to rebellion among poor whites and the sizable Asian population. A key figure in this rebellion is Emperor Norton, who acts as a mediating force between the typically opposed sides in revolting against the oligarchy, and turns San Francisco into a stronghold for the rebels. When President Latham is overthrown and the rebels occupy Sacramento, the new government faces threats from all directions. In a bid to ensure stability, popular support, and recognition from their southern monarchical neighbor and biggest trade partner, the rebels crown Norton as Emperor of California. California and Mexico become stable New World monarchies and closely tied through culture and trade. Norton marries a Habsburg and starts a stable dynasty. During the 21st century, California's economy sky rockets, cementing it as the dominant power among the remnants of the former USA.