For a government action violates the Establishment Clause one of the following must be present:
1. The Act must serve a secular, non-religious purpose;
2. The Act must not promote or inhibit religious practice;
3. The Act must not create an excessive entanglement with religion.
This test is from the USSC decision in Lemon v. _____ (the name escapes me).
Kurtzman, Kly. It's one of the primary Court decisions I have my students study.
The thrust of your post is correct. The establishment and free exercise clauses of the 1st amendment were a reaction to historical British efforts to establish the Anglican Church in the Colonies and, later, to preclude such sordid religious conflicts such as that exemplified by the history of Maryland.