Place the lentils into a pot and cover with the water. Bring to a rolling boil over high heat for 5 minutes, then cover and remove from heat. Meanwhile, rinse the rice in cold water until water comes out clear.
Heat 2 tablespoons olive oil or vegetable oil in a skillet over medium heat. Stir in the rice for about 1 minute, until the grains turn opaque and white, then stir in the lentils and water. Bring the rice mixture to a boil, then cover and reduce heat to medium-low for 5 minutes. Stir once, then cover and reduce heat further to low. Continue cooking, covered (don't remove the lid!) until the rice is tender, about 15 minutes more.
Meanwhile, heat the remaining 2 tablespoons of oil in the skillet over medium heat. Stir in the onion; cook and stir until the onion has softened and turned translucent, about 5 minutes. Reduce heat to medium-low, and continue cooking and stirring until the onion is very tender and dark brown, 15 to 20 minutes more. When the rice is ready, stir in the caramelized onion and season with salt.