Preheat your oven to 350°F. While it heats, dice the onion into 1/2-inch pieces and mince the garlic cloves. Measure out the marinara sauce, separating 1/2 cup into a small bowl for the pasta and keeping the remaining 23.5 oz for the meat sauce. Have all cheeses measured and ready, and cut the softened cream cheese into small chunks so it incorporates smoothly into the cheese mixture.
Heat a large skillet over medium-high heat and add the ground beef and Italian sausage, breaking them apart as they cook. Once the meat is browned and cooked through (about 5-7 minutes), carefully drain off the excess grease. Add the diced onions and minced garlic, cooking for 2-3 minutes until fragrant and the onions begin to soften. Pour in the reserved marinara sauce (the larger portion), add salt, black pepper, and red pepper flakes to taste, and stir well to combine. Simmer this sauce on low heat while you prepare the other components—I like to let it bubble gently for 5-10 minutes so the flavors marry together.
Bring a large pot of salted water to a boil and cook the spaghetti according to package directions until al dente. While the pasta cooks, make the cheese mixture: in a large bowl, combine the softened cream cheese, sour cream, and cottage cheese, stirring until smooth and well blended. This will be your creamy layer that contrasts beautifully with the meat sauce.
Drain the cooked spaghetti and immediately toss it with the butter and the 1/2 cup reserved marinara sauce from Step 1. The butter coats the noodles beautifully and the light sauce prevents them from sticking together. Season with a pinch of salt and pepper to taste.
Spread half of the buttered spaghetti in the bottom of a 9x13 inch baking dish, creating an even layer. Spread all of the cheese mixture from Step 3 over the pasta layer, then top with the remaining buttered spaghetti. Pour the meat sauce from Step 2 evenly over the top, spreading it to cover the entire surface. Sprinkle the shredded mozzarella cheese evenly over the meat sauce, then finish with the parmesan cheese on top.
Bake the assembled spaghetti in your preheated 350°F oven for 30-40 minutes, until the cheese on top is melted and bubbly and the edges are heated through. The exact time depends on how deep your baking dish is—start checking at 30 minutes. When done, remove from the oven and let the dish rest for 15 minutes before serving; this allows the layers to set slightly, making serving cleaner and helping the flavors settle. I find this resting period crucial because it prevents the whole dish from sliding around when you plate it.