Your last sentence is not accurate because the pronoun "We" needs to be clarified..........
In the early 1800's Texas was part of Mexico, but was not very inhabbited by anyone. Mexico wanted the land to be more productive (bigger tax paying population, farms), so it allowed Americans to settle the area as long as 3 conditions were followed;
The American settlers had to learn Spanish, become Catholic, and follow Mexican laws....
The settles were dragging their asses regarding the following of these directives, so the Mexican govt. got pissed and sent messengers to these "Texans" to tell them that they were out of compliance, and to get with the program.
The Texans said, "Screw you, we don't want to be part of Mexico anyway, we want to be our own country....The Republic of Texas !
Naturally, Mexico got pissed and The Texas War of Independence was on, with The Texans winning this war of independence against Mexico in 1836 (This was the war involving The Alamo, Davy Crockett, Sam Houston ).
The United States had nothing to do with this war between the Texans and Mexico. The Texans wanted to be their own country.......and following their victory, they were for 10 years.....
After 10 years (1846), the Texans said "We dont want to be our own county anymore, let's join the U.S. as a state !"
The U.S. said hell yeah ! Welcome aboard! When Texas joined the U.S., there was a disagreement between the U.S. and Mexico regarding the border, and this disagreement resulted in the Mexican/American War......
So when you say "we" you're really talking about the Texans, who were not in alliance with the United States at the time