Preheat the oven to 350°F and lightly grease a 9×13-inch baking dish. Set it aside while preparing the squash mixture.
Melt 2 tablespoons of butter in a large skillet over medium-low heat. Add the sliced squash and chopped onion and cook for 8–10 minutes, stirring occasionally, until the squash is tender. Drain any excess liquid well.
In a large bowl, whisk the eggs until lightly beaten. Add the cheddar cheese, milk, salt, black pepper, and cayenne if using. Stir until evenly combined.
Add the cooked squash and onions to the egg mixture and gently stir until everything is coated. Melt the remaining 2 tablespoons of butter in the skillet and stir it into the casserole mixture.
Transfer the squash mixture to the prepared baking dish and spread it into an even layer. Sprinkle the crushed crackers evenly over the top.
Bake uncovered for 40–45 minutes, or until the cracker topping is golden brown and the center is set without noticeably jiggling when the dish is gently moved. Add a Pinch
Remove the casserole from the oven and let it rest for about 5 minutes. Spoon onto plates and serve warm alongside your favorite main dishes.