Preheat the oven to 350°F (180°C).
Heat the olive oil in a large skillet over medium-high heat. Add the chopped onion and carrot and cook, stirring, until softened and translucent, about 3–4 minutes.
Add the minced garlic and cook for about 30 seconds until fragrant.
Pour in the passata (or marinara) and add the dried Italian herb, oregano, sugar, ground fennel, garlic powder, onion powder, 1 teaspoon salt, and black pepper. Stir to combine and reduce heat to low; simmer gently while you cook the pasta.
Bring a large pot of water to a boil, add 1 tablespoon salt, and cook the ziti for 2 minutes less than the package directions. Reserve 1/3 cup of the pasta cooking water, then drain the pasta and return it to the pot.
Stir 2 cups of the tomato sauce and the reserved 1/3 cup pasta water into the drained pasta until evenly coated.
Spread the sauced pasta into a 9×13-inch (23x33 cm) baking dish in an even layer.
Dollop the ricotta over the pasta, then pour the remaining sauce evenly over the top. Sprinkle with shredded mozzarella and shredded parmesan.
Bake in the preheated oven for about 25 minutes, until the cheese is golden and bubbling.
Remove from the oven and sprinkle with chopped parsley or basil, if using. Serve warm.