Preheat the oven to 350°F. Slice the tops off each sourdough loaf and hollow out the centers to create bowls. Place the bowls and tops on a baking sheet and bake for 10 minutes to crisp the insides.
Melt the butter in a large pot over medium heat. Add the diced onion and cook for 4 minutes until softened. Stir in the minced garlic and cook for 1 minute more.
Sprinkle the flour over the onion mixture and stir for 2 minutes to form a roux. Slowly whisk in the chicken broth, making sure no lumps remain.
Add the chopped broccoli, salt, and pepper. Bring the soup to a gentle simmer and cook for 8 minutes until the broccoli is tender.
Reduce the heat to low. Stir in the milk and let it warm through for 2 minutes. Gradually add the shredded cheddar cheese, stirring until fully melted and the soup thickens.
Ladle the hot soup into the prepared sourdough bowls and serve immediately with the toasted tops on the side.