Their weakness may have been a curse that was cast by the gods.
Perhaps the gods cursed the undead because they tried to become gods.
We could say that the undead are a group of the cursed, with each member of the race being cursed with a different curse by a different god.
The curse can be something good and something bad at the same time.
For example: a human wizard, desecrating his life in an attempt to be immortal, ends up receiving a curse
"imperfect immortality" has become immortal, plus at a cost, he no longer has the pleasures of a mortal life as a human without taste, smell or touch.
As I suggested earlier, there can be several types of curses, so the undead organize themselves into clans, the division is done according to the curse.
One strength of the undead is that, because of their long life, they have a lot of knowledge about history, technology, theology, magic and biology...
Their libraries are the oldest in the world, with tens and hundreds of thousands of books.
Their armies are numerous but more disorganized, many of their soldiers are living dead with no consciousness, just puppets.
It is said that among the living dead there are ancient races that have been extinguished by time but due to "immortality" still resist.
Translated with www.DeepL.com/Translator (free version)