Preheat the oven to 400°F. Grease a 9x13-inch casserole dish generously with butter.
In a medium saucepan, melt 1/4 cup of butter over medium heat. Add the diced onion and cook for 3 to 4 minutes until translucent. Introduce the minced garlic and sauté for an additional 30 seconds.
Sprinkle in the flour and stir continuously, allowing it to cook for 1 to 2 minutes until it takes on a light tan hue. Gradually pour in the stock while whisking to prevent lumps. Bring the mixture to a gentle simmer and cook until thickened to a gravy-like consistency. Stir in the cheddar cheese, then season with salt and pepper. Remove from heat.
Place the frozen hash browns into a large mixing bowl. Pour the cheese sauce over the potatoes and stir until thoroughly combined. Transfer the mixture to the prepared baking dish and level the surface.
Bake uncovered on the center oven rack for 45 minutes. To achieve a crisp golden top, switch to the broiler setting and broil on high for 5 minutes. If your baking dish is not broiler-safe, increase the oven temperature to 500°F and bake for an additional 3 minutes.
Allow the casserole to cool briefly before serving warm. Leftovers can be stored in the refrigerator for up to 5 days and reheated in the microwave.
Optional – Fried Serrano Rings
In a small skillet, heat olive oil over medium heat. Once hot, add the serrano slices and cook for 2 to 3 minutes until browned. Transfer to a paper towel-lined plate and sprinkle with coarse salt. Serve as a topping for added heat and crunch.