what is 'illegal' is political interference or chain of command. you have a politiciian explicitly telling soldiers in the US army what to do These soldiers trained soldiers and know what is an 'illegal order' like raping and killing civilians even if they surrendered and had their hands with a white flag. Soldiers can get killed for refusing orders or court martialed for mutiny. and trained to never ever refuse an order to kill.
Tell you this even 2000 years ago, the soldiers didn't kill civilians. and wars and conflicts were fought between Kings and soldiers. civilians were not involved in state to state disputes. somehow today ,countries semm to have no problem with bombing and killing civilians wh have no support for the enemy.