This is a relief of a commander. Ordered by a superior commander, as you say, Mattis.
General Mattis has no command authority. He could not order the removal/relief of this General.
Maybe Mattis has no command authority, but Trump sure as hell would not fire this guy without consulting Mattis. I am not arguing with your strict logic. I just saying the PEOTUS would not undercut Mattis without at least asking: Should this guy stay or go?
Mattis will want a combat officer if he can find one.