Preheat the oven to 350°F and position a rack in the center.
Bring a large pot of salted water to a boil and prepare the onion, garlic, and cheese while waiting.
Chop the onion into small pieces and mince the garlic. Shred 8 ounces of mozzarella cheese and cube the remaining 4 ounces. Grate the Parmesan cheese as well.
In a large pot or Dutch oven, heat olive oil over medium-high heat. Once hot, add the onion and cook until soft and golden, about 5 to 6 minutes. Add the garlic and sauté until fragrant, about 30 seconds to 1 minute. Incorporate the ground beef, kosher salt, Italian seasoning, and black pepper, stirring until the beef is browned, approximately 8 minutes. Remove from heat.
Cook the rigatoni in the boiling water according to the package instructions until al dente, usually around 10 to 12 minutes.
After cooking, drain the pasta in a colander.
Combine the drained pasta with the beef mixture in the pot. Stir well to combine.
Pour in the marinara sauce and mix everything together. Then, add 1 cup of the shredded mozzarella and the cubed mozzarella, folding them in gently.
Transfer the pasta mixture to a 9x13-inch baking dish, or split it between two (8-inch) baking dishes. If freezing, use a metal or disposable dish. Top with the grated Parmesan and the remaining 1 cup of mozzarella cheese.
Bake in the preheated oven for about 30 minutes, until the edges are bubbling and the cheese is melted and slightly browned.
Let the dish cool on a wire rack for 5 to 10 minutes before serving, and garnish with fresh basil if desired.