The roughly 2,500 troops in Iraq and 900 in Syria are described by US officials as part of an operation to keep the Islamic State from regaining a foothold in the region. But with the Islamist militant group largely degraded, American soldiers now find themselves targeted by other adversaries.