Why? To take pictures? Were they in airplane mode?
And it's one thing to not expect the Taliban to DF your phones. The Ukrainian military, especially with prior control of the cell infrastructure, is another story.
If you need to coordinate with someone who isn't sitting by a radio, you need to call them (including the local govt, your own civilian personnel, etc.). You might not be issued a radio at all, so a phone is what you have.
Commercial telecommunications are an important part of any military worldwide, when they are available - so you use them until someone actually starts DFing you accurately, and then even after that, it's a risk to be managed and certainly not black & white.
In this case the Ukrainian military should be able to use the cell towers to DF every phone. I don't get why that would be a risk rather than a certainty.
And it's one thing to not expect the Taliban to DF your phones. The Ukrainian military, especially with prior control of the cell infrastructure, is another story.