Again, don't you understand how constitutions work?
See, when you have a country based around a constitution, the government can set up whatever rules it likes - but they have to abide by the constitution. In the case of the laws we're talking about here, they were put in place a long time ago and, fairly recently, they were reviewed and found to be unconstitutional. In other words, the laws existed, but it was later determined that said laws were in contravention of the constitution and, therefore, illegal.
That's how constitutional law works. The fact that a law was in place doesn't make it constitutional, or even legal. Strictly speaking, the laws should never have been put in place because the constitution strictly forbids the putting in place of those laws. The fact that for many generations the government ignored this fact doesn't mean that said laws were just or legal.