Preheat oven to 350°F (175°C). Spray a 9×13-inch casserole dish with nonstick spray.
Cook spaghetti 1–2 minutes under package instructions until just al dente. Drain and rinse under cold water.
In a large skillet over medium-high heat, brown Italian sausage until no pink remains. Drain excess fat.
Add chopped onion and minced garlic; sauté 2 minutes until fragrant.
Stir in marinara sauce, tomato paste, Italian seasoning, salt, and pepper. Remove from heat.
In a bowl, whisk eggs, Parmesan, and melted butter. Toss with cooled spaghetti until coated.
Layer half the noodles in the casserole dish. Spread half of the sausage sauce over noodles, sprinkle with half the mozzarella.
Repeat layers with remaining noodles, sauce, and cheese. Cover with foil.
Bake 30 minutes. Remove foil and bake 5–10 minutes more until cheese is melted and golden. Let rest 5–10 minutes, garnish with basil, and serve.