Preheat oven to 350F
Butter a 13 x 9 inch glass or ceramic baking dish and set aside
Spread out brioche on a large rimmed baking sheet and bake, tossing halfway through, until golden brown and crisp, 25 - 30 minutes. Be careful - don't let it go too long. Let cool, then transfer to a large bowl (the biggest bowl you can find)
In the meantime, heat 4 tbsp butter in a large skillet over medium heat. Cook squash, leeks, and thyme, stirring occasionally, until squash is tender, 10 - 12 minutes. Mix in a pinch of cayenne pepper and season with salt. Transfer to bowl with brioche
Whisk eggs, cream, milk, sugar, 2 tsp salt, and a pinch of cayenne in a bowl to combine
Add 1 cup of cheese to the bowl with brioche and toss evenly to combine. Transfer to prepared baking dish and pour 5 cups of the egg mixture over it. Gently press bread into liquid to coat and toss a bit. Pour remaining egg mixture over and let sit 15 minutes
Scatter remaining 1/2 cup cheese over bread pudding and bake until puffed and custard is set in the center, 60 - 75 minutes. Let cool at least 10 minutes before serving