"If the process is illegal, that's hardly the fault of the programmers is it?"
Apparently you've never heard the expression "Ignorance of the law is no defense."
You're attitude is why a lot of people think all devs are nothing but bodge merchants.
By analogy with the construction industry that would be designing a building below the known safety standards or building it with materials which don't meet their specs.
So yes it is illegal.