It is not up to the military to determine whether the commander in chief is legitimate or not. It's up to the civilian branches, which have determined him to be legitimate. To have the military contravening the judgement of the civilian branches strikes at the very heart of the constitution.
The Civilian branches did not do their duty. This is no excuse for the military not to do theirs.