Hey dude! I just enter ilegally in your house, with guns, and You gonna sign your deep title so I can own half of your house from now on.
((Looks like ilegal shit? Because it si)
Neglecting a few key facts - Mexico invaded the US, not the other way around. Texas, which had been independent for a decade at that point, joined the US as a state in exchange for debt relief. The Mexican government tried to pull a fast one and sneak some troops into disputed territory on the day of Texas's admission to the Union, to try to claim it was theirs all along.
There was just one problem. There was already a US garrison there, anticipating such shenanigans. The Mexican army attacked that garrison, starting the war.
Almost at the outset of the war, Californians, fed up with Mexico's long neglect, went into rebellion and overthrew the tiny garrison there, and promptly attempted to join the US as a state (but didn't meet the criteria, and was admitted as a territory).
Short of total Mexican victory, neither Texas nor California would have gone back - they were not lost to the war, but to internal rebellions.
Reginaldo Guerrero
Jenny Omeasoo
Ella Baesso
Aakanksha Roychowdhury
Amna Khan Niazi
Jennifer Krupa-Hawk