In a large bowl, combine the ground beef, thyme, Worcestershire sauce, whole milk, breadcrumbs, egg, garlic powder, black pepper, French onion soup mix, and about one-quarter of the cooled onions.
Mix just until the ingredients are evenly combined. Cover the bowl and let the mixture rest for 15 minutes so the breadcrumbs can absorb some of the milk.
Preheat the oven to 350°F.
Shape the meatloaf on a parchment-lined sheet pan, or press it into a 9-inch loaf pan.
Bake for 35–40 minutes.
Remove the meatloaf from the oven and top it with the shredded Gruyère and remaining caramelized onions.
Return it to the oven and continue baking for about 15–20 minutes, or until the cheese is melted and the center of the meatloaf reaches 160°F.
For extra browning, broil the top briefly while watching it closely.
Let the meatloaf rest for about 15 minutes before slicing and serving.