What situations might it be acceptable to design something that would be considered unethical?

In the recent StackOverflow Developer Survey, over 100,000 developers were asked a series of questions reflecting their experiences working in the industry.

On the subject of ethics, two questions were asked:

enter image description here

I was quite surprised that when posed with a hypothetical situation where they are asked to write code for a product or purpose that they consider clearly unethical, over 40% of the developers say that it would depend on the situation.

I think one possible scenario could be if it is relating to the health and well-being of the user but it forces them to do something against their wishes, but even that's a pretty difficult to say is clearly unethical.

Considering their response to another question about AI, the responses regarding ethics is a bit worrying, especially if designers work closely with developers to implement solutions:

enter image description here

If faced with the same question, what situation would it be acceptable for designers to take part in a design process for a product or purpose that they consider clearly unethical?