Iraq’s prime minister is celebrating the collapse of the Islamic State’s self-declared caliphate, but American and Iraqi officials are recognizing that much more is needed to stabilize newly reclaimed areas and prevent militants from making a comeback.