Cook the spaghetti or linguine according to package instructions until al dente. Drain and set aside.
In a large skillet, heat the olive oil over medium heat. Add the chopped onion and cook until translucent, about 5 minutes.
Stir in the minced garlic and sliced mushrooms, cooking for an additional 4-5 minutes until the mushrooms are tender.
Add the shredded chicken and frozen peas to the skillet, mixing well.
Pour in the chicken broth and heavy cream, then stir in the dried thyme, salt, and black pepper. Allow the mixture to simmer for about 5 minutes, stirring occasionally.
Preheat your oven to 350°F.
In a large mixing bowl, combine the cooked pasta with the chicken and mushroom mixture. Stir in half of the Parmesan cheese and half of the mozzarella cheese.
Transfer the mixture to a greased 9x13-inch baking dish. Top with the remaining mozzarella and Parmesan cheese, followed by the breadcrumbs.
Bake in the preheated oven for 25-30 minutes, or until the top is golden and bubbly.
Let it cool for 5 minutes before serving.