Preheat oven to 350°F. Grease a 9-inch deep-dish pie plate or a 9x9-inch baking dish.
Cook the spaghetti according to package directions until al dente. Drain and let cool slightly.
In a large bowl, toss the cooked spaghetti with the beaten eggs, parmesan cheese, and melted butter. Press the mixture into the prepared pie plate to form a crust, pushing it up the sides.
Brown the ground beef with the diced onion in a skillet over medium-high heat, breaking it into crumbles. Add the garlic and cook for 30 seconds. Drain excess fat.
Stir in the marinara sauce and Italian seasoning. Season with salt and pepper. Simmer for 5 minutes.
Spread the ricotta cheese over the spaghetti crust. Sprinkle 1 cup of mozzarella over the ricotta.
Spoon the meat sauce evenly over the cheese layers. Top with the remaining 1 cup of mozzarella.
Bake for 25-30 minutes until the cheese is melted and bubbly and the edges are golden.
Let the spaghetti pie rest for 10 minutes before slicing. This helps it hold together when you cut it.