01 - Preheat the oven to 400°F. Lightly grease a medium baking dish.
02 - Bring a large pot of salted water to a boil. Cook the pasta until al dente following package directions. Drain and set aside.
03 - Heat olive oil and butter over medium heat in a large skillet. Add chopped onion and cook for 2 to 3 minutes until softened.
04 - Add sliced mushrooms and cook for 5 to 7 minutes until browned and most liquid evaporates. Stir in minced garlic and cook for an additional minute.
05 - Sprinkle flour over vegetables and stir thoroughly. Gradually whisk in whole milk to prevent lumps. Add heavy cream, dried thyme, ground nutmeg, salt, and black pepper. Simmer for 3 to 4 minutes until the sauce thickens.
06 - Stir fresh spinach into the sauce and cook until just wilted, about 1 minute.
07 - Remove skillet from heat. Add cooked pasta and half of both cheeses. Stir until fully incorporated.
08 - Transfer the pasta mixture into the prepared baking dish. Evenly sprinkle remaining mozzarella and Parmesan cheese on top.
09 - Bake in the preheated oven for 20 to 25 minutes until the top is golden and bubbling.
10 - Allow the dish to stand for 5 minutes before serving.