Heat the oven to 400°F. Rub the squash with olive oil, prick them with a knife in a few places, put them on a sheet pan, and roast until just tender when pierced with a knife, about 45 minutes. Let cool completely. Peel the squash, remove the seeds, and cut the flesh into slices 1/4 inch thick. Set aside.
Meanwhile, in a large sauté pan, heat 1/4 cup olive oil over medium-high heat. Add the onions; sauté, stirring occasionally, until they soften, about 5 minutes. Turn the heat to low; cook until the onions caramelize to a golden brown, about 20 minutes. Add the garlic; cook 1 minute. Put the onions in a colander in the sink to drain off the oil. Set aside.
Heat the oven to 350°F. Lightly grease a 9x13-inch casserole. In a large bowl, toss the caramelized onions with the squash slices; spread them out in the casserole.
In a medium bowl, mix the eggs, egg yolks, cream, thyme, nutmeg, salt, and pepper. Pour this over the squash and onions and massage well to distribute the custard mixture evenly. Cover the dish loosely with foil. Bake until the custard is set and a knife inserted comes out clean, about 55 minutes.