The legal question is whether there is a religion-specific exception to mandatory vaccination laws, and if so where does it come from? These are state-specific laws, so one would have to look at a specific state to answer the question. In Washington, this is implemented in the exemptions section, RCW 28A.210.090
(1)(b) A written certification signed by any parent or legal guardian
of the child or any adult in loco parentis to the child that the
religious beliefs of the signator are contrary to the required
immunization measures; or (c) A written certification signed by any
parent or legal guardian of the child or any adult in loco parentis to
the child that the signator has either a philosophical or personal
objection to the immunization of the child.... (2)(c) Any parent or legal
guardian of the child or any adult in loco parentis to the child who
exempts the child due to religious beliefs pursuant to subsection
(1)(b) of this section is not required to have the form provided for
in (a) of this subsection signed by a health care practitioner if the
parent or legal guardian demonstrates membership in a religious body
or a church in which the religious beliefs or teachings of the church
preclude a health care practitioner from providing medical treatment
to the child.
In other words, you have to just say you object for one of these reasons, or you have to show that you are a member of a sect that is known to object. The law does not, however, provide a central registry of churches whose teachings preclude immunization, not is there any investigation of the claim allowed under the law.
In Nevada, NRS 392.437 does not expressly include the personal-or-philosophical exception contained in Washington law:
A public school shall not refuse to enroll a child as a pupil because
the child has not been immunized pursuant to NRS 392.435 if the
parents or guardian of the child has submitted to the board of
trustees of the school district or the governing body of a charter
school in which the child has been accepted for enrollment a written
statement indicating that their religious belief prohibits
immunization of such child.
However, there is, likewise, no further vetting of the claim for exemption where the state determines if the religion claim is real. Nevertheless, under a Nevada-type law, one would have to make the claim that the belief was religious in nature, in order to claim the Free-Exercise exemption.
California has no such exemptions – they eliminated an existing exemption – and predictable they were sued (Brown v. Smith). The state district court rejected a free exercise argument, though one based on the California constitution (the court however cited various free exercise rulings in the US). That court points to case law saying that "the state’s wish to prevent the spread of communicable diseases clearly constitutes a compelling interest", suggesting that such a law might pass strict scrutiny (the First Amendment has limited exceptions).
The ultimate legal source of such exceptions is the First Amendment, specifically the "Free Exercise Clause". In a nutshell, that says that the government cannot prohibit a person from exercising their religious beliefs. If that means you must pray at noon, you must be allowed to pray at noon; if that means that you cannot eat lettuce, you cannot be forced to eat lettuce. Because "Congress shall make no law respecting an establishment of religion", the government also may not get into the business of approving or disapproving religions.
The courts have indicated that a personal or subjective belief does not enjoy Free Exercise protection. In Wisconsin v. Yoder 406 U.S. 205 the court commented that
Although a determination of what is a "religious" belief or practice
entitled to constitutional protection may present a most delicate
question, the very concept of ordered liberty precludes allowing every
person to make his own standards on matters of conduct in which
society as a whole has important interests. Thus, if the Amish
asserted their claims because of their subjective evaluation and
rejection of the contemporary secular values accepted by the majority,
much as Thoreau rejected the social values of his time and isolated
himself at Walden Pond, their claims would not rest on a religious
basis. Thoreau's choice was philosophical and personal, rather than
religious, and such belief does not rise to the demands of the
Somewhat contradictorily, in US v. Seeger, the court held that "The test of religious belief within the meaning of the exemption in § 6(j) is whether it is a sincere and meaningful belief occupying in the life of its possessor a place parallel to that filled by the God of those admittedly qualified for the exemption", but "The exemption does not cover those who oppose war from a merely personal moral code, nor those who decide that war is wrong on the basis of essentially political, sociological or economic considerations, rather than religious belief", and "There is no issue here of atheistic beliefs, and, accordingly, the decision does not deal with that question" (that is, the court did not rule on atheistic religious beliefs).
Under the premise that one claims a religious exemption, there is no further investigation as to how compelling the claim is. On the other hand, if one makes a claim that merely looks like slapping the religion label on a personal objection, one might well run afoul of the state law, and then the courts might be forced to judge that very delicate question. This could arise, for instance, in the context of the Islamic distinction between haram and makruh acts, where the former are absolutely forbidden and the latter are "recommended against".