But if it isn’t illegal, then it’s legal, right? So if there were nothing forbidding it then it would have been allowed?
I think you're looking for Texas v. White (1869).
https://en.wikipedia.org/wiki/Texas_v._White
The unilateral efforts to secede undertaken by some states were null. As if they had never happened.
It remains the law of the land, as far as I know.