Seceded states could certainly do that (forming another country) if they wished. Once seceded, the Constitution and its prohibition about treaties, alliances, and confederations with other states or countries no longer applied to them. Whether this was "right" or appropriate for them to do a matter of opinion. It was probably safer for them to join with other seceded states at that point in time.
The Constitution did not prohibit secession and did not require approval from any state, Congress, Court, or the Federal Government for secession. Nor did it give power to the Federal Government or to individual states or to groups of states to stop other states from seceding. Indeed, IMO the Constitution wouldn't have been ratified if such approval had been required or such power had been given.
The Constitutional legality of secession has been roundly debated on this forum and several other strings.
There is no provision in the Constitution for doing so, even though secession was a hot topic during the writing of the Constitution. The founders and ratifiers were well aware but chose not to enumerate it.
The core reason is that when any territory or country, as in the case of Texas, joins the Union, by consent of Congress, the people of the new State are no longer citizens of that State, they are citizens of the USA.
Their USA citizenship cannot be taken away by the State due to an act of secession. Citizenship rights can only be limited by being guilty of a felony, that is a power given to States.
Any change in USA citizenship to a foreign country citizenship can only be done by the USA, through Congress.
Remember, States do not have rights, they have powers, only citizens have rights protected directly by the federal government and Constitution.
Nor did the Constitution, or any Founder, ever expect the United States to submit humbly to military assault from secessionist states.
Indeed, in one of its clearer sections it defined exactly what such war-making is.