Bring a large pot of water to a boil over high heat. Add a large pinch of salt and cook the pasta according to package directions for al dente, about 8 minutes.
Meanwhile, place a large skillet over medium-high heat. Add the oil and bell pepper. Cook until the bell pepper starts to soften, about 1 minute. Add the salmon and red pepper flakes, if using, to the skillet and sprinkle with salt and the black pepper. Cook for about 2 minutes without stirring. Then continue cooking and stirring until the salmon is cooked through, about 2 minutes. Add the lemon juice. Transfer the mixture to a large bowl and set aside.
For the pesto: Place the basil, garlic, pine nuts, salt and black pepper in a blender. Start on low speed, then increase to medium. With the motor running, slowly drizzle in the olive oil and blend until smooth. Stop the blender and scrape down the sides. Add the cheese and blend a few seconds just to incorporate. Taste and adjust the seasoning.
Drain the pasta and add it to the bowl with the salmon. Add the pesto and toss. Taste and adjust the seasoning. Serve immediately, or refrigerate until chilled. Finish with basil leaves and grated cheese if desired.
Spread the pine nuts on a rimmed baking sheet and cook at 400 degrees F until toasted, 4 to 6 minutes.