This is the kind of comment that passes a "common sense" sniff test, but is impossibly naive in the context of any legal system. This is only slightly tenable if the question before the court is one of pure statutory interpretation. If the *only* question before the court is, "what does this law say and do?" then in *some* circumstances, you would answer the question despite unfavorable policy implications, and even indicate that the legislature should address the found defects.
Conversely, in common law jurisdictions, which includes the United States, judges are relied on to shape the direction of the law through analysis of precedent, existing statutory schemes, and policy considerations. Further, legislators in common law jurisdictions draft laws knowing that the common law exists, and borrowing definitions and language from the common law with the intent that judges fill the gaps and interpret with an eye towards precedent and policy considerations. So, your position is plainly and openly incompatible with much of the US legal system, and many other common law jurisdictions. And even elsewhere, the lines are far less clear-cut.
There are conflicts of laws, superseding laws, open questions of a laws scope and breadth. Many laws explicitly call out policy effects as being a consideration in the application of said law. There is the law of Equity; an entire separate body of law that runs parallel within our system, which explicitly requires judges to balance the burdens (consequences) of a decision and certain notions of fairness resulting from the application of law to fact patterns and individuals, for the issuance of certain relief. These centuries-old frameworks often explicitly includes "policy considerations" within their well-established factor tests. We have statutes like ERISA that broadly govern all employment benefits plans (remember how healthcare is tied to employment in the USA?), and explicitly state that all remedies under this broad law, applying to all employed persons in the US, are to be in equity. I could go on and on and on.