The issue isn't protection from prosecution. Laws don't exist to protect people from prosecution. The case is essentially no different from laws that prohibit people under 21 from buying alcohol. They can be prosecuted for it, but I can't.
In addition to the antimiscegenation statute, Virginia also had laws for the protection of "legal" marriages (i.e., laws between parties of the same race). I'm gathering from your responses that you understand the equal protection clause to have been adopted to prevent citizens from harm by other citizens. The adoption of the equal protection law did not provide citizens with protection from unequal treatment by other citizens. For example, hotels were not prevented by the Fourteenth Amendment from refusing to provide service to blacks. That kind of private discrimination was made illegal in 1964 with the passage of the Civil Rights Act. In order to make an equal protection claim, a citizen has to demonstrate that he is being harmed or threatened with harm from some form of "state action."
The case is essentially no different from laws that prohibit people under 21 from buying alcohol. They can be prosecuted for it, but I can't.
You've put your finger on an important problem for courts. All statutes discriminate in one way or another. The law that you're talking about discriminates on the basis of age and the courts just do not feel that it would be appropriate for the judiciary to become very assertive in that area. In Loving, however, the antimiscegenation statute discriminated on the basis of race and the courts have held that, given the historical association between the adoption of the Fourteenth Amendment and the end of slavery, they will closely scrutinize the claimed necessity of any law that discriminates on the basis of race. As far as the courts are concerned, any statute that expressly discriminates on the basis of race is presumptively unconstitutional.