Preheat oven to 350°F (175°C) with rack in center. Grease a 9x13 inch baking dish thoroughly with cooking spray or butter.
Bring a large pot of salted water to a boil. Cook spaghetti 1-2 minutes less than package directions until al dente. Reserve 1/2 cup pasta water, drain, and do not rinse.
In a large bowl, whisk eggs, melted butter, Parmesan, salt, and pepper until combined. Add warm spaghetti and toss until every strand is coated.
Transfer spaghetti to prepared baking dish and spread in an even layer, pressing gently to create a flat, compact base.
Heat a large skillet over medium-high heat. Brown ground beef for 5 minutes, then add onion and cook 3-4 minutes until soft. Add garlic and cook 30 seconds until fragrant.
Drain excess grease. Stir in Italian seasoning, garlic powder, onion powder, and red pepper flakes. Pour in marinara sauce and simmer for 5 minutes. Season with salt and pepper.
In a medium bowl, combine softened cream cheese, sour cream, and Italian seasoning. Stir until completely smooth with no lumps.
Spread cream cheese mixture evenly over pasta base. Top with meat sauce, spreading gently. Sprinkle with mozzarella and Parmesan cheese.
Cover dish tightly with foil. Bake for 35 minutes until hot and bubbly throughout.
Remove foil and continue baking uncovered for 15-20 minutes until cheese is golden and bubbling. Optionally broil 2-3 minutes for extra browning.
Rest on counter for at least 10 minutes before slicing. Garnish with fresh parsley or basil, slice into squares, and serve.