6 tablespoons extra-virgin olive oil
3 large onions, thinly sliced
1 large bay leaf
1 1/2 teaspoons ground coriander
1 teaspoon ground cumin
Pinch of cayenne, plus more to taste
1 1/4 teaspoons fine sea salt, plus more as needed
3 fat garlic cloves, minced
1 teaspoon cumin seeds
1 teaspoon black pepper
1/8 teaspoon ground allspice
1 (15-ounce) can whole peeled plum tomatoes
1 pound small pasta, such as rotini or shells
3/4 cup chopped parsley or cilantro (or use a combination of cilantro and parsley), plus more for serving
8 ounces shredded Cheddar
1/2 cup grated Parmesan
Hot sauce, for serving (optional)
Heat 1/4 cup oil in a 12-inch skillet over high heat. Add onions and bay leaf, and cook, stirring frequently, until softened and browned in spots, 12 to 20 minutes. (Reduce heat if the pan starts to scorch.) Lower heat to medium, and stir in coriander, ground cumin, cayenne and 1/4 teaspoon salt; cook 1 more minute. Transfer half the onions to a bowl and reserve (leave the bay leaf in the skillet).
Add garlic, cumin seeds, pepper and allspice to the skillet, and stir. Cook until fragrant, about 1 minute. Pour in the juice from the canned tomatoes. Use your hands or kitchen scissors to squish or cut the tomatoes into pieces and add to pan. Fill the empty tomato can with water, and pour into the skillet. Add remaining 2 tablespoons oil and remaining 1 teaspoon salt, and bring mixture to a simmer. Simmer until thickened, about 20 minutes. Taste, and add more salt and cayenne if you like. Remove bay leaf.
As mixture cooks, heat oven to 400 degrees and bring a large pot of salted water to a boil. Cook pasta until just about 2 minutes shy of al dente. Reserve 1 cup pasta water, and drain pasta.
Stir pasta, reserved pasta water, and parsley into skillet with tomato sauce. Top with reserved browned onions, Cheddar and Parmesan. Transfer to oven and bake until golden and bubbly, 20 to 25 minutes. If you like, you can run the pan under the broil to brown the top, or leave it as is. Let cool slightly, top with more parsley, if desired, and serve with hot sauce, if you like.