WASHINGTON — Defense Secretary Jim Mattis, whose experience and stability were widely seen as a balance to an unpredictable president, resigned Thursday in protest of President Trump’s decision to withdraw American forces from Syria and his rejection of international alliances.