Trump’s call for ending U.S. military involvement in the Middle East and bringing the troops home was a feature of his presidential campaign, but it flies in the face of many decades of bipartisan American policy, even as the Trump administration and its immediate predecessor have tried to give additional attention to what they see as long-term security threats elsewhere, including from China and Russia.