I worry that a feature meant to circumvent or break the law will not be easy to spot. Many projects are broken into smaller pieces that interact, many times the laws or rules change from state to state. Even in regular day to day work I'll see a feature request that effectively undoes another request. Often developers are working in areas in which they are not subject experts.
I think it's easy to write code that could (or even will) be misused; it may not look troubling until it's interacting with the larger system.
We have to be aware that the things we create aren't always going to be used for what we intend them to be used for. So you frequently have to ask yourself "how could this be abused?" That is something that engineers frequently ask themselves. I don't understand why developers can't be asked to do the same.
My concern really revolves around the scapegoating and protecting developers from situations where there is more grey than black or white. But that is not a sheild from personal responsibility or moral obligation, the questions you raise are important in their own right.
But because of that I'm not calling for legal obligation. But I'm calling for more people thinking about the abstraction and how what they write could be abused. But it is no easy matter. Ethics are hard.
In engineering only a PE really has the legal obligation. Their on the hook if something goes wrong. But at the same time everyone involved has an ethical obligation to ensure that best practices are being followed and nothing is being done that would result in harm. This is even if they wouldn't get in any legal trouble.
Or that a doctor has both legal and ethical obligations. Their ethical obligations can many times supersede their legal ones.
I am not arguing that we who write software need to be held legally accountable, but that we need to think about any potential ethical concerns with what we write. And if you are saying "well yeah" then we're in agreement. And I think this should be pervasive. I think we should frequently talk about it.
But we are in high demand right now. Many of us have the leverage to say "I don't agree with this" and go work somewhere else. If you personally have that ability I think it should be used as well. But I understand not everyone has that leverage.