Preheat the oven to 180°C. Spread the nuts out on a small baking pan and toast lightly, about 5 minutes. Set aside to cool.
Pulse together 1/4 cup of the walnuts and the garlic in a food processor; add the broccoli, basil, broth, nutmeg, red pepper flakes if using, 3/4 teaspoon salt and the lemon juice, and pulse until just combined. Slowly drizzle in the oil through the feed tube with the processor running and puree until a slightly chunky sauce forms, scraping down the sides of the bowl as needed. Add 2 tablespoons of the cheese and pulse until incorporated.
Cook the pasta in a large pot of salted water according to the package directions. Drain, reserving 1/2 cup of the cooking liquid.
Toss the pasta with the pesto in the dry pot or a mixing bowl, along with some of the reserved cooking liquid. Add the remaining cooking liquid if needed and additional salt to taste.
Transfer the pasta to individual bowls and sprinkle with the remaining 1 tablespoon cheese. Chop the remaining walnuts and scatter on top. Garnish with basil leaves and serve.