The states don't have to leave the Union. There is a thing called a Constitutional Convention where the States can convene delegates and pass an Amendment that would specifically limit the Federal govt. It has never been done, but is absolutely legal and prescribed by the Constitution. Amendments passed by State Convention cannot be rescinded by Congress, the President or even the Supreme Court.
It requires a 3/4's majority of the states to pass an Amendment this way, but there are already that number of states considering, or that actually have passed, legislation voiding federal health care and firearms laws.