WASHINGTON—On Wednesday evening, President Trump watched as two of his biggest congressional allies took to Fox News and the House floor to criticize him for not insisting that funds for a southern border wall be delivered in a new spending bill, according to people close to Mr. Trump.

How, Mr. Trump asked his advisers, did he end up here? In addition to brickbats from Republican Reps. Jim Jordan and Mark Meadows, he was being roundly attacked by other conservatives as “gutless” for not taking the issue all the way to a government...