Heat 1 Tbs. of the butter in a large skillet over medium heat. Add the onions and season with a little salt and pepper; cook until tender, 5 to 7 min. Remove the onions and set aside. In the same skillet, heat another 1 Tbs. butter. Add half of the mushrooms and season with 1/4 tsp. marjoram, 1/2 tsp. salt, and 1/4 tsp. pepper. Cook over high heat until the muchrooms are browned and all the liquid has evaporated, 5 to 7 min. Set aside with the onions. Repeat with the remaining mushrooms, using another 1 Tbs. butter and seasoning again with 1/4 tsp. marjoram, 1/2 tsp. salt, and 1/2 tsp. pepper. When the mushrooms are brown, add the first batch of cooked mushrooms and the onions back into the skillet. Add the Madeira. Cook, stirring frequently, over high heat until the liquid evaporates and the mixture is a rich brown, about 5 min. Remove from the heat and set aside to cool.
Heat the oven to 350F. In a large bowl, whisk together the broth, cream, eggs, egg yolks, thyme, and the remaining 1/2 tsp. marjoram, 1/2 tsp. salt, and 1/4 tsp. pepper. Add the bread and the mushroom mixture to the custard; toss. Let sit for 30 min., stirring occasionally, to saturate the bread. Gently stir in the cheese.
Brush a 2-qt. (or 9x13-inch) baking dish evenly with the remaining 2 tsp. butter. Pour the bread mixture into the baking dish, distributing the ingredients evenly. Bake in the hot oven until lightly browned and firm, 40 to 45 min. (Alternatively, butter eight 1-cup ramekins and divide the bread mixture among them. Bake until lightly browned and firm, 30 to 35 min.)