If what you say is true, (and I am not saying it's not) then why does "Congress shall make no law respecting an establishment of religion" apply to states?
Because, in a series of court decisions over the years, the Supreme Court has held that various provisions of the Bill of Rights are now "extended" or mandatory as to the states.
The 1st Amendment has been extended. The 2nd has not yet been.
The Bill of Rights restricts the federal government. The court has used the 14th Amendment to extend some of those restrictions to the states. But it's a piece by piece process.
A state legislature is not Congress. Congress is that beast in Washington DC that we all hate, but it only passes federal laws.
The plain language of the first amendment only applies to that beast in DC. Your state legislature was free to do whatever it wanted.
I don't remember which Supreme Court case changed that. I've read it and probably cited it in several legal briefs, but it escapes me now.
Essentially, the Supreme Court said that Congress AND YOUR STATE LEGISLATURE can make no law respecting the establishment of religion.
They're doing that on a case by case basis, and it's not just the 2nd that hasn't been rewritten by the Supreme Court.