Preheat your oven to 375°F (190°C).
Make the spaghetti: in a large 4½-quart (4.5 L) casserole dish, combine the spaghetti, tomato sauce, water, tomato paste, onions, garlic, basil, oregano, salt, pepper, and crushed red pepper flakes (if using). Use tongs to mix everything until combined. Cover and bake for 40 minutes, stopping halfway through to stir and make sure the pasta isn’t sticking to the bottom of the pan.
Make the alfredo sauce: While the spaghetti is baking, melt the vegan butter in a saucepan over medium-high heat. Add the garlic and cook for about 1 minute while stirring. Sprinkle with the flour and stir to make a paste. Cook the flour paste for 1–2 minutes while stirring frequently to cook the flour. Whisk in the plant-based milk, nutritional yeast, salt, basil, onion powder, and pepper. Bring to a simmer and cook until the sauce is nice and thickened, about 5 minutes. remove from the heat.
After the pasta has baked for the 40 minutes, remove the lid and spread the alfredo sauce over the pasta. return to the oven and bake another 10–15 minutes, until bubbly. Allow the pasta to cool for 10 minutes before serving.