Boil a large stock pot of water and cook the pasta according to package directions, about 8-10 minutes.
While the pasta is cooking, dice the onion, slice the mushrooms if they aren't pre-sliced, halve the grape tomatoes, and mince the garlic.
In a frying pan over medium heat, sauté the onion for 3-4 minutes until it becomes soft and translucent.
Season with salt and pepper.
Add the mushrooms and grape tomatoes and sauté for another 2-3 minutes.
Finally, add the spinach and garlic and turn off the heat and stir occasionally for 1 minute until the spinach cooks down slightly and the garlic becomes fragrant. This will allow the spinach to slightly wilt and stay a vibrant shade of green, and it will also ensure that the garlic doesn't burn.
Once the pasta is cooked, reserve some of the starchy cooking water and drain the pasta.
Add the cooked pasta to the sautéed vegetables and stir in the cream cheese until it softens to form a sauce. I like to break up the cream cheese into little "dollops" to help it incorporate easily. If the sauce is too thick, add a little bit of the reserved pasta cooking water at a time until it gets to the consistency you want. Save any extra pasta cooking water in your fridge for an easy way to bring leftovers back to life. If you forget to save any of the cooking water (it's easy to do in the moment!), don't worry! You can use vegetable or chicken stock instead. If you don't have either of those items on hand, plain water will work in a pinch; you'll just want to check that the seasoning is to your preference at the end since the water won't be adding any additional flavor like the pasta water or stock would.
Add the basil and season with more salt and pepper if needed, and red pepper flakes if desired.