Preheat the oven to 375°F. Spray a 9×13-inch baking dish with nonstick cooking spray and set aside.
Bring a large pot of salted water to a boil. Cook the spaghetti according to package directions until al dente. Drain the spaghetti and set it aside.
In a large skillet over medium heat, melt the butter with the olive oil. Add the diced onion, celery, and green bell pepper. Cook for 4 to 5 minutes, stirring occasionally, until the vegetables soften.
Add the minced garlic and cook for 1 minute, stirring so it doesn’t burn.
Stir in the Cajun seasoning, cayenne pepper (if using), and red pepper flakes (if using). Cook and stir for an additional 45 to 60 seconds.
Pour in the chicken broth and heavy cream, stirring to combine everything. Bring the mixture to a gentle simmer, stirring occasionally, 7 to 10 minutes, or until thickened slightly.
Add the chicken, cooked spaghetti, 1 ½ cups shredded cheddar cheese, and grated Parmesan. Stir gently over low heat until the cheeses melt and coat everything evenly.
Taste and season with kosher salt and black pepper as needed.
Transfer the entire mixture to the prepared baking dish, spreading it out evenly. Top with the remaining shredded cheese.
Bake for 20 to 25 minutes, or until the top is hot, bubbly, and lightly golden. Broil for 1 to 2 minutes for a golden crust, watching carefully.
Remove from the oven and let it rest for 5 minutes. Garnish generously with sliced green onions before serving.