It depends on how the war is fought and what country is fighting it.
US generals sitting at some console in Florida are not going to get killed in Afghanistan.
Russian generals, actively engaging the enemy in Ukraine on the battlefield can and do get killed.
The Russian generals certainly are doing it wrong. Heck, their colonels are doing it wrong. If their leadership system, communications and staff are functional there should be no need to constantly send generals down to command battalions, companies, platoons.