Cook the pasta. Bring a large pot of well-salted water to a rolling boil. Add the gluten-free spaghetti and cook until just al dente according to package directions. Before draining, reserve ½ cup of pasta water. Drain and set aside.
Start the sauce.In a large skillet over medium heat, melt 3 tablespoons of butter. Add the lemon slices and cook for 1–2 minutes per side, until lightly golden and fragrant.
Flip the lemon slices, then add the minced garlic and shallots. Cook for 30–60 seconds, just until fragrant and lightly golden. Do not let the garlic burn. Remove the lemon slices from the skillet and set aside.
Deglaze with wine and add heat. Pour in the white wine and add the crushed red pepper flakes, if using. Bring to a gentle simmer and cook for about 5 minutes, allowing the wine to reduce and the alcohol to cook off.
Add stock and lemon juice. Stir in the gluten-free chicken stock and the juice from the remaining half of the lemon. Simmer for 5–7 minutes, until the sauce reduces slightly.
Cook the shrimp.Add the shrimp in a single layer and cook for 2–3 minutes per side, just until pink and opaque. Do not overcook.
Finish the sauce. Add the remaining 3 tablespoons of butter and stir until melted and glossy.
Toss with pasta. Add the cooked pasta to the skillet and toss gently to coat in the sauce. If needed, add a splash of reserved pasta water to loosen and help the sauce cling to the noodles.
Finish with Parmesan and serve. Remove from heat and sprinkle with freshly grated Parmesan cheese. Toss lightly and serve immediately.