From before written history, all the way into the modern era, a stick with a pointy end was the most commonly used implement of warfare, with very few exceptions (mostly wealthy warrior nobility. And the Roman legions). Yet, as a symbol of pre-modern military might, it is vastly overshadowed by the sword. Why is this? How long has this been the case?
As you've already hinted at, there's a boring counter-answer to your question: when, where, and symbolizing what? You specify military might, but very often depictions of military implements symbolize other things, such as power, authority and nobility. I'm going to mainly take a look at Near Eastern and Iranian history, since this is what I am most familiar with, and I hope this will at least partially satisfy your curiosity.
We can start by dissecting a sword-containing symbol that is probably somewhat famliiar to you - the [Shir-o Khorshid](https://en.wikipedia.org/wiki/Lion_and_Sun#/media/File:Lion_and_Sun_(Pahlavi_Dynasty).svg) or Lion and Sun, a longstanding symbol of Iranian royalty. In the Pahlavi and many other variants of it, it is depicted holding a scimitar (from Persian shamshir, really just meaning sword). However, the scimitar is a Central Asian weapon, and its inclusion in the symbol actually only goes back to the 11th-century Seljuk era; the Lion and Sun are considerably older, and actually not of Iranian but Mesopotamian origin. There is no end to what could be written on the importance of these two symbols, but I'm going to try and keep it simple.
The sun once upon a time had paramount importance because it was the domain of Shamash (or Sumerian Utu), the god of Law. Shamash is perhaps most famously depicted handing a ceremonial mace to Hammurabi. As you might guess, the mace or scepter was a paramount symbol of royal and legal authority in ancient Mesopotamia, and still today is a part of royal regalia in many places (see also e.g. the swagger stick). In the Achaemenid era, Shamash was probably conflated with the Indo-Iranian god of the covenant, Mithra, who becomes associated with the sun and equipped with the vazra, or club, and we can see this living on in e.g. the Investiture of Shapur II in the Sasanian era where we find Mithra on the far left with a radiant crown and a staff.
The lion is probably familiar from the tablet series, [The Lion Hunt of Ashurbanipal](https://en.wikipedia.org/wiki/Lion_Hunt_of_Ashurbanipal#/media/File:P1050552_(5022050256).jpg), one of the true gems of the British Museum. Most interesting with respect to your query, we find in the linked image two other symbols of Near Eastern kingship - the bow and the spear, used to hunt the lion. The most immediate example of the importance of these symbols I can think of comes from the Achaemenid era - the two offices of spear-bearer and bow-bearer were among the most senior positions members of the high nobility could attain, granting immediate access to the Great King's ear and immense personal stipends. We also see these two weapons depicted on the Dareic, a type of Achaemenid coin. There are also inscriptions extolling the Great King's skill with these weapons.
So, as you can see, a cursory cross-section of the history of a composite symbol that today includes a sword reveals at least three other weapons as symbols of royal authority - the mace, the spear and the bow, with the sword being of far more recent pedigree. But also, as the Lion Hunt reveals, the spear and bow don't necessarily merely symbolize military power (though they were certainly of paramount military importance) - they also connote the bravery and valor associated with hunting, a long-running royal pastime.
Now, I've already given the basic answer for why the Lion-and-sun symbol today has a sword in it (The Seljuk Invasion) and hopefully shown that the spear and bow have, in fact, been very important symbols, but there is of course a broader context your query appplies to. It's way out of my wheelhouse to discuss the use and symbolism of swords in say, medieval Europe, but I'd like to point to my above discussion of weapons as symbols not just of military might but of power and authority. It isn't necessarily the case that the symbol of power is the most widely used or militarily important weapon - it could also be the weapon that only a privileged few are able to own.