Preheat the oven to 350°F (175°C).
Cook the spaghetti in a large pot according to package instructions until al dente. Drain and set aside.
In a skillet, melt the butter over medium heat. Add the sliced mushrooms and sauté until softened, about 5 minutes.
Sprinkle the flour over the mushrooms and cook for 2 minutes, stirring continuously.
Gradually whisk in the chicken broth and milk, stirring until the mixture thickens, about 5 minutes.
Stir in garlic powder, onion powder, salt, pepper, and half of the Parmesan cheese until well combined.
In a large mixing bowl, combine the cooked spaghetti, shredded chicken, frozen peas, and the sauce. Mix until everything is coated well.
Transfer the mixture to an oven-safe baking dish. Sprinkle the remaining Parmesan cheese and mozzarella cheese evenly on top.
Bake in the preheated oven for 25 minutes or until the cheese is bubbly and golden.
Remove from the oven, garnish with fresh parsley, and serve warm.