McClellan was a general, not the Secretary of War. Presidents have fired their generals many times; not so with the Secretary of War (Defense since 1947).
Semantics
You could make a strong case the Secretary of Defense today occupies a similar position as General-in-Chief of the Union then. As you point out, the position wasn't even created until 1947.