Bring a large pot of well-salted water to a boil. Cook 12 oz spaghetti until al dente, about 1 minute less than the package says, usually around 9 minutes. Scoop out 1 cup of the pasta water before you drain it.
Meanwhile, warm 3 tbsp olive oil in a large skillet over medium heat. Add 4 cloves garlic and 1/4 tsp red pepper flakes and cook for 1 minute, until fragrant but not brown.
Add 1 1/2 lb ripe cherry tomatoes and 1 tsp salt. Cook, stirring now and then, until the tomatoes collapse and turn saucy, 8 to 10 minutes. Press a few with the back of a spoon to help them along.
Add the drained spaghetti and a splash of the pasta water. Toss for 1 minute until the sauce clings to the pasta, adding more water if it looks dry.
Add the mozzarella off the heat. It should soften, not melt into strings.
Take the skillet off the heat. Stir in 1/4 cup Parmesan cheese and 1 cup fresh basil, keeping a few basil leaves for the top, then fold in 8 oz mozzarella. Season with black pepper and finish with the reserved basil.
Notes
Use the ripest cherry tomatoes you can find. In winter, a can of whole cherry tomatoes works too: cook them for a few minutes less.Leftovers keep for 2 days in the fridge. Reheat them in a skillet with a splash of water.