> but it doesn't refuse to write the code without first being told why it wouldn't be a better idea to do X first
Then don't ask it to write code? If you ask any recent high quality model to discuss options, tradeoffs, design constraints, refine specs it will do it for you until you're sick and tired of it finding real edge cases and alternatives. Ask for just code and you'll get just code.
To be fair, they're primed to write code, even when you don't ask for it. I explicitly tell Claude "do not write code" when I don't want any, otherwise it'll spit some out just to say hello (world).