To make the nutty sauce, dry-roast all the ingredients except the tamarind sauce in a frying pan, then add them to a blender with the tamarind sauce and a little water and process to a fine paste. Set aside.
To make the chiles, heat 2 tablespoons of the vegetable oil in a large frying pan, add the turmeric and onion sauce, and heat gently. Add the tomatoes, chile powder, and salt.
Whisk in the yogurt and mix well. Continue to stir until the mixture thickens, about 5 minutes. Add the nutty sauce paste and cook for 10 to 12 minutes, stirring occasionally.
In another frying pan, heat the remaining oil and lightly sauté the chiles for 2 to 3 minutes, turning several times. Transfer the chiles with tongs to the yogurt mixture and add the mustard seeds and curry leaves to the oil and heat until the mustard seeds pop.
Then transfer this oil to the yogurt mixture and stir everything together. Cook on low heat for an additional 2 to 3 minutes. Check for salt and add the lemon juice.
Heat the oil in a saucepan, add the bay leaves, cloves, cinnamon stick, and cardamom pod and cook for 1 minute over medium heat. Add the onion slices, lower the heat, and simmer until they are soft.
Add the water and bring to a boil, then reduce the heat and simmer for 30 minutes.
Remove from the heat and cool, then puree the sauce in a blender.