Prepare the Oven and Pan: Preheat your oven to 350°F. Grease a 9-inch springform pan or deep pie dish with cooking spray or butter.
Cook the Pasta: Bring a large pot of salted water to boil. Cook spaghetti according to package directions until al dente. Drain well and let cool slightly.
Make the Meat Sauce: While pasta cooks, heat a large skillet over medium-high heat. Add ground beef and cook, breaking it up with a spoon, until browned and cooked through (about 6-8 minutes). Add diced onion and cook for 3-4 minutes until softened. Add minced garlic and cook for another minute. Stir in marinara sauce, Italian seasoning, salt, and red pepper flakes. Simmer for 10 minutes, stirring occasionally.
Prepare the Spaghetti Base: In a large bowl, combine the cooked spaghetti with beaten eggs, Parmesan cheese, melted butter, salt, and pepper. Mix thoroughly until all pasta is well coated.
Make the Ricotta Mixture: In a separate bowl, combine ricotta cheese, egg, Italian seasoning, and garlic powder. Mix until smooth and well combined.
Assemble the Friendship Spaghetti Pie: Press the spaghetti mixture firmly into the bottom and up the sides of the prepared pan, creating a crust. Spread the ricotta mixture evenly over the spaghetti base. Top with the meat sauce, spreading it evenly. Finally, sprinkle the mozzarella and remaining Parmesan cheese over the top.
Bake: Cover with foil and bake for 25 minutes. Remove foil and bake for an additional 15-20 minutes until cheese is melted and lightly golden.
Rest and Serve: Let the Friendship Spaghetti Pie cool for 10 minutes before removing from springform pan or slicing. Garnish with fresh basil if desired and serve in wedges.