When a person dies, their soul ascends to the astral realm to rest with the gods. However, a piece of them, called the Ka, remains on earth. This piece is the off cast remains of the soul and a reflection of who that person was, from their personality, beliefs, characteristics, etc. It is like a footprint or echo of that soul, which represents their presence on earth. While it is reflective of that person, it is truly just the discarded remains of their spirit, and thus bypasses the laws against necromancy.
There is a ritual that uses the Ka of a person as a power source. The Ka is compressed into an artificial construct called a golem, and used to carry out certain tasks. This procedure is viewed differently across cultures. It is seen in some places as a way to honor great warriors after their death, serving as an honorary guard for royalty or soldiers on the battlefield. In others, it is used as a way for individuals to work off debt after they pass on, as a way to spare their families from those responsibilities. Still in others, it is viewed as a form of atonement for prisoners to continue serving their sentence after they die. Regardless of how it is seen, it is an accepted practice across nations.
The Ka has no control over whether it is resurrected or not. However, The recently deceased are not prime candidates for this ritual because they are more difficult to bring back to life. Those who have been dead for decades or centuries are far easier to use. The farther back you go, the more simpler it is to use someone's Ka for the resurrection procedure (etc: Julius Caesar vs your dead grandpa). How can this make sense?