Cook the spaghetti. Bring a large pot of salted water to a boil.
Add spaghetti and cook until al dente. Reserve at least 1/2 cup of the pasta water before draining.
Prep the salmon. Pat the salmon dry and season both sides with salt and pepper. Cut into large chunks (about 2-inch pieces) for even cooking.
Sear the salmon. Heat 1 tbsp olive oil in a large skillet over medium-high heat.
Add the salmon and sear 2–3 minutes per side until just cooked through and lightly golden. Remove to a plate and tent loosely with foil.
Build the flavor base. Reduce heat to medium. Add the remaining 1 tbsp olive oil and the butter to the same skillet.
Stir in shallot and cook 2–3 minutes until softened. Add garlic and cook 30 seconds until fragrant.
Deglaze. Pour in the white wine and scrape up any browned bits. Let it simmer 2–3 minutes until reduced by about half.
Make it creamy. Stir in the cream and Dijon.
Simmer gently for 2–3 minutes until slightly thickened. Avoid a hard boil to prevent curdling.
Add lemon and dill. Stir in lemon zest, 1 tbsp lemon juice, and most of the dill. Taste and season with salt, pepper, and red pepper flakes if using.
If using cheese, whisk it in now until melted. The sauce should be silky.
Toss the pasta. Add the drained spaghetti to the skillet. Toss to coat, splashing in reserved pasta water a little at a time until the sauce clings and looks glossy.
Fold in salmon. Gently flake the salmon into large pieces and fold into the pasta.
Warm through for 1–2 minutes. Add more lemon juice or dill to taste.
Serve. Plate the pasta and top with extra dill, black pepper, and a squeeze of lemon. Serve immediately.