Preheat the oven to 375°F and position the rack in the upper third of the oven.
In a medium mixing bowl, combine all ingredients for the cheese layer, mixing thoroughly until smooth and creamy. Set aside.
Bring a large pot of salted water to a boil, then cook the spaghetti for 2 minutes less than the package instructions suggest. Drain and return the pasta to the pot.
In a large skillet over medium-high heat, sauté the Italian sausage and onion, breaking up the sausage as it cooks. Cook for about 10 minutes or until the sausage is browned and fully cooked through. Add garlic and red pepper flakes to the skillet, cooking for another minute. Remove any excess fat from the pan.
Transfer the sausage mixture to the pot with the cooked spaghetti. Stir in the marinara sauce, tossing until the pasta is evenly coated.
Spread half of the pasta and sauce mixture in an even layer at the bottom of a 9x13-inch baking dish. Evenly layer the prepared cheese mixture over the pasta layer.
Top the cheese layer with the remaining pasta and sauce mixture, spreading it out evenly. Sprinkle shredded mozzarella cheese over the top.
Cover the baking dish with foil and bake for 30 minutes. Remove the foil and broil for 2–3 minutes, watching closely, until the cheese becomes bubbly and golden.
Allow the casserole to rest for 5–10 minutes before slicing and serving. Adjust salt and pepper to taste, if necessary.