Bring a large pot of salted water to a boil. Add the spaghetti and cook until al dente according to package instructions, usually around 8 minutes. Drain well and toss with 1 tablespoon of olive oil to prevent sticking. Set aside to cool slightly.
Heat the remaining 1 tablespoon olive oil in a large skillet over medium heat. Add the diced onion and sauté for 3-4 minutes until softened. Add the minced garlic and cook for another minute until fragrant. Add the ground beef and cook, breaking it apart, until browned and cooked through, about 6-8 minutes. Drain any excess fat.
Pour in the crushed tomatoes, then season with oregano, basil, salt, and pepper. Stir well and let the sauce simmer for 10-15 minutes, allowing flavors to meld and the sauce to thicken slightly.
In a large mixing bowl, whisk together the eggs. Stir in the mozzarella, Parmesan, and chopped parsley. Add the cooked spaghetti and the meat sauce, folding everything together gently but thoroughly, ensuring every strand is coated with sauce and cheese mixture.
Grease your casserole dish lightly with olive oil or nonstick spray. Pour the spaghetti mixture in, pressing it down gently to compact it evenly. This helps the pie hold its shape when sliced.
Preheat your oven to 350°F (175°C). Bake the casserole uncovered for 30-35 minutes, until the top is golden brown and bubbly. Let it rest for 10 minutes before slicing to serve.