In a large, heavy skillet, heat the oil over medium heat. Cook the onions, stirring often, until soft, about 10 minutes. Put aside until assembling.
To make the béchamel:
In a medium saucepan over medium heat, melt the butter until foamy. Add the flour and cook, stirring constantly, until the mixture is foamy, about 3 minutes. Gradually add the milk, stirring until smooth. Cook, stirring, until the sauce is thick, about 3 minutes. Stir in the nutmeg and salt and pepper to taste.
To make the gratin:
Preheat the oven to 400°F (200°C).
Butter a gratin dish. Put a ½ inch layer of sliced zucchini, followed by the béchamel and caramelized onions. Top with another ½ inch layer of zucchini slices. Sprinkle the cheese and dot with the butter.
Bake the gratin for 30 minutes or until golden brown.
Notes
Sometimes I add wilted greens (spinach, kale, broccoli rabe, etc). Add what you enjoy eating.