Place lentils in a saucepan with onions, garlic, ginger and 2 cups of water. Bring to a boil over high heat.
Reduce heat to medium-low, partially cover, and simmer, stirring occasionally, until lentils are tender, about 25 minutes. Transfer to a food mill or food processor and purée, then transfer to a clean saucepan.
Add 1 cup water and lemon juice, season with salt, then bring to a simmer. Cook, stirring occasionally, until dal is the consistency of thick soup, about 20 minutes. (if thick, add more water; if thin, simmer longer.)
Just before serving, prepare tarka. Heat oil in a small skillet over medium-high heat. Add mustard seeds, chiles and curry leaves. Fry until fragrant, about 1 minute. Transfer dal to 4 bowls, season with spiced oil, and serve with rice.