Cook the pasta: Bring a large pot of salted water to a boil.
Cook the pasta until just shy of al dente (about 1–2 minutes less than package directions). Drain and set aside.
Brown the meat: In a large skillet, warm olive oil over medium heat. Add the ground beef (or turkey/sausage), breaking it up as it cooks.
Season lightly with salt and pepper. Cook until browned and no longer pink, about 6–8 minutes. Drain excess fat if needed.
Sauté aromatics: Add chopped onion to the skillet and cook until translucent, 3–4 minutes.
Stir in garlic and cook 30–60 seconds until fragrant.
Build the sauce: Pour in marinara. Stir in oregano, basil, and red pepper flakes if using. Simmer 5 minutes to meld flavors.
Taste and adjust salt and pepper.
Mix the cheese layer: In a bowl, combine cottage cheese, ricotta (if using), egg, Parmesan, a pinch of salt, and a few grinds of black pepper. Stir until smooth. If you like it extra herby, add a teaspoon of chopped fresh parsley or basil.
Preheat the oven: Set to 375°F (190°C).
Lightly grease a 9x13-inch casserole dish.
Assemble: Spread a thin layer of sauce on the bottom of the dish. Add half the pasta, spoon half the cheese mixture over it, scatter half the spinach, and ladle on more sauce. Sprinkle with a third of the mozzarella.
Repeat with the remaining pasta, cheese mixture, spinach, more sauce, and another third of the mozzarella. Finish with remaining sauce and a final layer of mozzarella. Dust with extra Parmesan.
Bake: Cover the dish with foil (tent it slightly to avoid sticking) and bake for 20 minutes.
Remove foil and bake 10–15 minutes more, until bubbly and lightly golden on top.
Rest and serve: Let the casserole rest 10 minutes so it sets. Garnish with fresh basil or parsley. Slice and serve warm.