This is a question I had while learning the parsha on thursday. The first Rashi says that this rule only applied during a optional war, but not during a Mitzvah war. The second Rashi says that the Torah only teaches this because a man otherwise wouldn’t resist. Leaving aside whether this is true or not the question logically follows what do you expect the soldiers to do in a Mitzvah war acoording to Rashi’s explanation. Later on I’ll give a couple answers in the comments.