Preheat oven to 350°.
Combine water, lentils, and 1/4 teaspoon salt in a large saucepan. Bring to a boil; cover, reduce heat to medium-low, and simmer 20 minutes. Drain lentils in a colander over a bowl, reserving 1 cup cooking liquid.
Combine lentils and diced onion in an 11 x 7-inch baking dish. Combine 1/4 teaspoon salt, reserved cooking liquid, ketchup, and the remaining ingredients. Pour the ketchup mixture over the lentil mixture, stirring to combine. Bake at 350° for 1 hour.