Why did former Secretary Mattis trash Trump?
With Mattis it is personal. There are things we don't know.
What we do know and is in the public domain is this, the intelligentsia said that if we withdrew form that area the Turks would come in and wipe out the Kurds who have been our long term allies. Mattis was big on this and this is why he resigned.
Trump did withdraw our troops. But you know what else he did? Trump sent a letter to the Turkish President Erdogan telling him that if he continues hostilities towards the Kurds that the United States would destroy the Turkish economy. Trump ended the letter to Erdogan with "don't be a fool". The Kurds are fine.
President Trump's letter to Erdogan: