no that order was in regards to the upcoming battle with the pagan meccans.
I know. So what? There are two factors you're failing to recognize:
1. The Qur'an does NOT mention the circumstances behind the vast majority of its verses. It simply issues decrees and makes claims irrespective of the circumstances that birthed them. When, for example, 9:29 says, "Fight those who believe not in Allah", it does not mention the historical context. It comes across as a generalized command, and since your god is 'perfect', that's exactly how he wants it to be taken. There is no mitigation of such open-ended and general decrees.
2. More than once the Qur'an states that it is a collection of examples and "similitudes from which Man may take admonition". That means commands to fight are
NOT one-offs applicable only to whatever was happening 1400 years ago. They are examples to follow for all time. Your religion tells you that "fighting has been ordained for you", and yes, that means you in the here and now and forever until "the whole of religion is for Allah".
in the end no battle occurred. the city surrendered and its inhabitants were given immunity
Yes, in the same way that Paris was not won by the Nazis in a specific battle. They both saw the military might arrayed against them and sued for peace. If the Meccans had tried to keep their city -
THEIR city, Mohamed would have attacked them (in the name of self defense of course).
The predictable whataboutism that followed is deleted.