In the majority of the modern fantasy worlds the dead are buried in crypts and tombs. At the same time, these places are frequently crawling with undead - skeletons, zombies, etc. I understand religious aspects of burying the dead, but in a world where the undead are fact, surely practicality would take over and the majority of the dead would get cremated. What other (practical ideally) purpose could be devised for the bodies to be instead religiously cleansed and then buried?
Contamination: As illustrated in Return of the Living Dead, burning the 'corpses' spreads zombieness further.
Nastier alternatives: Per Skyrim's Ash Spawn, the magic that would reanimate zombies reanimates burnt ashes into something even more hazardous.
Power generation: Cleanse and bury the dead, sure, but first chain them up to Conan the Barbarian style manual generators, whose shafts protrude from the crypt you've sealed to electrical equipment above ground. No sense having a zombie apocalpyse and a climate change apocalypse at the same time.
Bioremediation: There are only so many evil spirits in the world. Trap them in dead people incarcerated securely in coffins (or power generators) deep beneath the earth, and the world can go back to normal.
Ecosystem services: Powers that be find that the zombies are doing a service in keeping human numbers manageable.
Honor: In the steady state of ecologically sustainable population replacement, there is one zombie "born" per person born. Destroying one zombie by dishonorable means means that one of the young warriors will never have the chance to pass his or her initiation, because there is no zombie available to be captured and ritually incinerated to show their hardness of character.
Here's my take. In almost all religions nobody gets upset if you bury the body because you don't know what to do with it. Many do if you do burn it when it wasn't supposed to be. (Also cremation is time consuming and resource consuming.) It's a lot simpler to just tie the body down and then maybe cut a few major tendons/break some bones before burying it then it is to gather up the resources for a cremation. Also some ghosts are really upset because there body wasn't buried. Imagine being plagued for life because you can't bury the body! (Having burned it.)
So 1: It's expensive to burn bodies enough that no undead can pop up and 2: And two not everybody wants to be burnt and will come back to haunt if you do.
You could always place the recently deceased into wooden boxes that are nailed shut and bury them under 6 feet of dirt.
For bonus points fill the box with dirt or sand before sealing it and lowering it. This will prevent the body from being able to move at all if it revives. If the coffin does break, dirt can't pour in from above that way, so the undead will have no wiggle-room to escape.
To be extra sure, you could always put some rocks ontop of the box. Dirt is extremely heavy and moving through it is not as feasible as zombie movies would have you believe.
If undead exists then God could be real and religion has an actual purpose. If a body is blessed and buried on consecrated ground, it cannot arise as one of the undead and the soul is at peace.
If a body isn't interred properly, a necromancer can raise the dead. Cremation works mostly because it's hard for the necromancer to find the remains but if they do, they can still trap the soul as a wraith.
The only way to be sure is blessing and burial on holy ground.
What's So Bad about the Undead?
Burial practices in various places around the world are complicated. There is evidence in Skara Brae, the living visited the dead (after being de-fleshed by birds), often handling them. The Malagasy believe they need to dis-inter the dead and show homage, and that the dead don't rest until the body has decayed (anyone from Madagascar, feel free to edit this to be more correct).
In a world filled with death, ties to the dead can be essential to dealing with life. Where the undead are real, so too is the body a conduit for the dead to communicate with the living. The living feel the dead are close by, not really gone. One of the risks, obviously, is if someone other than the deceased takes up residence in the body. The very FACT that there are undead proves the connection! So rituals to protect the body from possession would be prevalent, and people might reach out to the dead for everything from approval of life choices, comfort, or even just asking Grandpa where he buried the money.
Re-animation is rare and preventable
Although it's possible that your cadaver will be re-animated by a necromancer or some evil spirit, it's not something that usually happens. Most bodies remain in the ground and don't come back to life as skeletons or zombies, so for most people, it's a non-issue. Of course everybody talks about the crypts and tombs that are crawling with undead, but nobody mentions the fact that the vast majority of corpses remain dead. A small chance of re-animation is not enough to dissuade people from their religious burial practices.
This is somewhat parallel to the practice of graverobbing - even today, it's possible that your corpse won't remain in the ground forever, but it's still unlikely that you'll be dug up. The fact that you might not rest in peace forever didn't really discourage people from being buried, although it did lead to some interesting grave security measures such as the mortsafe, dead house, and grave guards. If you're truly worried about your body being stolen or re-animated, there are steps you can take to prevent it while still complying with your preferred burial ritual.
This is because modern fantasy is based on European medieval period and so influenced (even if subconsciously) by Christian belief that the body should be preserved for resurrection. Plus another major religion today, Islam, is even more strict about body burial.
But throughout history the dominating view about the most prestigious form of burial changed a lot. For example, ancient Greeks and Romans were burning their dead and burying the remains in ceramic urns and boxes.
Similar situation was in middle bronze age in Europe - cremation was absolutely dominant form of burial.
So, there is no reason other than writer background that fantasy world would have preference for one burial method over the other. What's more, cremation do not prevent from having extensive burial architecture as sometimes massive structures were built for jar sized urns and those were often filled with rich grave goods.
The thing is in a lot of fantasy universes cremation is considered standard practice for burial, specifically because of the threat of dead people returning as undead. There was some major fantasy franchise where zombies were the main threat that had this as a plot point, I thought this was Game of Thrones but that doesn't make much sense given how most families are shown to have crypts.
Game of Thrones does do a good job in showing why cremation would pretty much be standard practice in any fantasy setting with undead. Burying bodies the traditional European way does nothing but provide potential armies for necromancers to use against the common folk, and because so many major cities and castles have crypts where they bury their dead deep within their fortified territory these crypts are basically massive trojan horses where a necromancer can subvert their defenses from within. In these kinds of cases the practical benefits of cremation would far outweigh any moral or cultural benefits of traditional European burial (or even other burial methods such as ossuaries or sky burial), simply because it is a matter of survival. Those who didn't practice cremation would be wiped out.
Disposing of possible undead by cremation even has some parallels in real life customs such as Norse funerary customs where it was believed if not properly disposed of the dead could return as a draugr, so they were burned to prevent them from returning as undead.
Reasons why the dead aren't burned can be religious or economic in nature. In Iceland where cremation was more expensive than burial due to wood being expensive they resorted to other methods of "preventing" the dead from returning as draugr such as deliberately damaging or tying up the body in some way. People also avoided cremation in continental Europe, which is where many of the undead myths that have filtered into the "not-medieval Europe" fantasy tradition came from, mostly because of the Christian prohibition on cremation because of the belief that you needed your body in one piece when the resurrection happened during the Second Coming of Christ. That restriction has been relaxed in recent years but was still a big deal then, which is why people generally didn't burn bodies despite a lot of folklore in that area at the time revolving around the dead returning to prey on the living.
Another factor: Why are they rising as undead? I'll look at the Dungeons and Dragons world as that's the one I feel most qualified to deal with. There are basically two types of undead:
The ones animated by some magical ritual. While cremation would stop them from being taken from the graveyard it wouldn't stop killing people and animating them and it wouldn't stop animating animals. There's no real gain from denying them bodies.
The self-replicating undead. In this case there is a very clear benefit to burning those who died at the hand of such a creature, but no benefit from burning any other body. How often will there be such kills with someone around to bury or burn the corpse, though?
In neither case does widespread cremation do you any good.