In a large pot, bring salted water to a boil. Add the spaghetti and cook according to package instructions until al dente. Reserve ½ cup of pasta water, then drain and set aside.
In a food processor, combine the avocados, minced garlic, basil leaves, lemon juice, and olive oil. Blend until smooth and creamy. If the mixture is too thick, add some reserved pasta water, one tablespoon at a time, until you reach desired consistency.
In a large mixing bowl, toss the drained spaghetti with the avocado sauce until the pasta is evenly coated. If desired, stir in more reserved pasta water to loosen the sauce.
Add red pepper flakes if using, and season with salt and pepper to taste. Gently fold in the cherry tomatoes for added freshness.
Serve immediately in bowls, garnished with extra basil leaves and a sprinkle of toasted pine nuts.