No, the military does NOT "serve at the pleasure of the president."
They take an oath to the Constitution first.
Hegseth: My approach has been simple, when in doubt, assess the situation, follow your gut, if it’s best for the military, make a change. We all serve at the pleasure of the president.