Preheat the oven to 400°F and set the oven rack in the middle position. Grease a 9 x 13-inch baking dish; set aside.
In a large pot of salted boiling water, cook rigatoni according to package instructions for very al dente. (It will continue to cook in the oven, so you want to undercook the pasta just a bit.) Drain; set aside.
Meanwhile, heat olive oil in a 12-inch cast iron skillet or Dutch oven over medium-high heat. Add the sausage and onion; cook until the sausage is no longer pink, about 5-7 minutes. Add the garlic and cook for 30 seconds.
Stir in both jars of the marinara sauce, basil, red pepper flakes, and salt and pepper. Simmer over medium-low heat for about 5-7 minutes. Remove from heat.
Add the cooked pasta to the sauce and toss to combine.
Spread half of the pasta mixture in the bottom of the prepared baking dish. Top with 1 cup of mozzarella and ¼ cup of Parmesan.
Top with remaining pasta mixture. Sprinkle with remaining 1 cup of mozzarella and ¼ cup of Parmesan.
Bake, uncovered, until the casserole is hot and bubbly, about 20 minutes.