You could almost hear the gasps from both sides of the ideological divide when President Trump unveiled the outline of his first budget late last month, proposing to slice $54 billion from the discretionary civilian budget next year to pay for a beefed-up defense.

That part of the budget pays for pretty much everything the government does other than the military, pensions and health insurance for older people. And it has been slashed repeatedly already. It adds up to only some $500 billion, hardly the best place to balance a $4 trillion federal budget. After Mr. Trump’s proposed cuts it would be 25 percent smaller than it was in 2010, adjusted for inflation.

Even Republicans in Congress, no friends of government spending, argued that the math made little sense. While they share Mr. Trump’s twin goals of balancing the budget and slashing taxes, they would prefer to square the circle by cutting the entitlements of Social Security and Medicare.

And yet Mr. Trump’s approach possesses a powerful political logic: The frazzled, anxious working-class men and women who voted for him like Social Security, Medicare and defense. Other government spending, not so much. Notably, there is little political cost for Mr. Trump — in fact, potential benefit — in going after means-tested programs for the poor.