Combine onion, garlic, galangal, ginger, and chilies in a food processor; pulse until a fine paste (rempah) is formed.
Heat coconut oil in a heavy-bottomed skillet or wok over medium heat. Sauté the spice paste, ground coriander, cumin, and turmeric for 8 minutes until the water evaporates and oil separates from the solids.
Incorporate the bruised lemongrass and kaffir lime leaves into the aromatic base.
Add the red lentils to the skillet, stirring for 2 minutes to toast the grains and coat them thoroughly in the spice paste.
Pour in the coconut milk and water. Bring the mixture to a gentle boil.
Reduce heat to low. Simmer uncovered for 25 to 30 minutes, stirring frequently to prevent the lentils from sticking to the bottom as the liquid reduces.
Once the lentils are tender and the sauce has thickened, stir in the palm sugar, salt, and tamarind paste.
Continue cooking for an additional 10 minutes, stirring constantly, until the coconut oil coats the lentils and the mixture reaches a dark, dry, and rich consistency.
Remove the lemongrass stalk and kaffir lime leaves before service.