In a large skillet over medium heat, add the canola oil. When it is hot, add the mushrooms, season with salt and pepper, and cook until they are lightly browned and have given up their liquid, about 5 minutes. Add the reserved onions, Italian seasoning, red pepper flakes, and garlic and cook for 1 minute. Stir in the reserved spinach and cook until warmed through, about 2 minutes. Toss in the pasta and cook until it is warmed through, about 2 minutes. At the last minute, stir in the basil, cheese, and olive oil. Serve immediately.
Preheat the oven to 350 degrees F.
In a large bowl, beat together 1 egg with a generous pinch of salt and pepper. Whisk in 1 tablespoon canola oil. Add half the spaghetti (reserve the other half for another use). Toss it well to coat and press it into a 9-inch deep dish pie pan to form a crust.
In a skillet over medium-high heat, add the remaining oil. When it is hot, add the onion and cook until it is softened, about 5 minutes. Add the garlic and cook for 1 minute. Remove from the heat and set aside (reserve half the cooked onions for another use).
In a large bowl, whisk together the remaining 2 eggs, milk, Italian seasoning, and salt and pepper, to taste. Stir in the cheese, spinach (reserve 3/4 cup spinach for another use), and remaining half of the cooked onions. Pour the mixture on top of the spaghetti pie crust, top with tomato slices, and sprinkle with Parmesan. Place onto a baking sheet and bake until the pie is set and golden brown, 30 to 35 minutes. Remove and let rest for 10 minutes before slicing.