Engineers in Canada are awarded an iron ring on graduation. It is worn on the writing hand's pinkey and meant to remind the engineer of their ethical obligations any time they sign a document.
I rarely wear mine because of exactly these kinds of mental gymnastics you describe. One never thinks they are being unethical because one changes their definition of ethical over time.
Instead of the ring, I kept the small slip of paper they give you at graduation. The symbol of the ring changes, but the words on that page never do. Here are a couple example sections: "my care I will not deny towards the honour, use, stability, and perfection of any works to which I may be called to set my hand." And "in the hour of my temptations, weakness, and weariness, the memory of this, my obligation".