The rules of war evolved specifically so armies would not feel the need to slaughter civilians.
Uniforms, military facilities kept separate from civilian infrastructure, etc. are rules for a reason.
If the group killing your soldiers isn't adhering to these rules of war then all the civilians in the area will find themselves at risk.
There is no world where combatants can expect to be allowed to enjoy the protections civilians are afforded while still killing you.
> There is no world where combatants can expect to be allowed to enjoy the protections civilians are afforded while still killing you.
That is true, but this does not take away the protection afforded to civilians. As a concrete example, if you take fire from people in civilian clothing holed up in a hospital, then you can return fire in that specific occasion, but you may not start to indiscriminately fire upon people in civilian clothing or hospitals.
(Also, you are not required to wear a uniform. You are required to distinguish yourself from the civpop by at least openly wearing arms and/or wearing a distinctive sign. Keep in mind not everyone in a uniform is a combatant, and not all combatants are armed.)
If the group killing your soldiers isn't adhering to these rules of war then all the civilians in the area will find themselves at risk.
There is no world where combatants can expect to be allowed to enjoy the protections civilians are afforded while still killing you.