There’s a fundamental difference, though, between EU citizenship and US citizenship.
In US law, citizenship (both of the Union and of the state) is “top-down”; it’s conferred by the federal Constitution. “All persons born or naturalized in the United States, and subject to the jurisdiction thereof, are citizens of the United States and of the State wherein they reside”. So Texan citizenship is not conferred by Texan law, but by the US Constitution.
Whereas in the EU, it’s bottom-up. Each member state has its own citizenship law, and it’s the law of a member state which confers citizenship of the state. EU law then confers Union citizenship on anyone who has citizenship of a member state.
So, if the UK leaves the EU, the UK ceases to be a member state, and EU law (as it now stands) will no longer operate to confer EU citizenship on UK citizens. I suppose one of the questions to be addressed in the exit negotations is whether this should be changed; should EU law allow those who currently have EU citizenship by virtue of their UK citizenship to retain it, or to elect to retain it? But, unless EU legislation to this effect is enacted, the current default position is that if the UK leaves the EU, UK citizens will cease to be EU citizens.
As for the US, IANA US L, but I think the position is less clear. If Texas leaves the US, could it be argued that Texans, resident in Texas, will no longer be “subject to the jurisdiction” of the United States, and therefore will no longer enjoy citizenship of the US (or indeed citizenship of Texas) through the operation of the US Constitution?
Citizenship of Texas is not a problem, since independent Texas will presumably enact its own citizenship law. But the laws of independent Texas can’t operate to confer US citizenship.
I suspect the answer is that at the moment there is no mechanism for Texas to leave the Union, so the Constitution doesn’t have to address, and in fact doesn’t clearly address, the question of what impact secession would have on the citizenship of Texans. Were the Constitution to be amended to allow secession, the amendment would have to address the consequences of secession for citizenship.