2 tablespoons olive oil, plus more for the baking dish
1 medium yellow onion, diced
1 large bunch broccoli rabe (about 1 pound), stems trimmed and coarsely chopped
4 cloves garlic, minced
Pinch red pepper flakes (optional)
1/2 cup low-sodium chicken or vegetable broth
Freshly ground black pepper
2 (15-ounce) cans white beans, drained and rinsed
1/3 cup grated Parmesan cheese, divided
1/4 cup whole milk
1/3 cup panko or other coarse breadcrumbs
Arrange a rack in the middle of the oven and heat to 350°F. Lightly grease a 2-quart casserole dish or an 8x8-inch baking dish with olive oil.
Heat the 2 tablespoons of olive oil in a large skillet over medium-high heat until shimmering. Add the onion and sauté until soft and translucent, about 3 minutes. Add the broccoli rabe, garlic, and red pepper flakes if using, and sauté for 1 minute. Add the broth, cover, reduce the heat to medium, and cook until the broccoli rabe is tender, about 5 minutes. Uncover and simmer until most of the liquid has evaporated, 2 to 4 minutes more. Season with salt and pepper as needed.
Remove from the heat and stir in the white beans and half of the cheese. Transfer the mixture to the baking dish and spread into an even layer. Pour the milk evenly over the top, then sprinkle with the breadcrumbs and remaining cheese.
Cover with aluminum foil and bake for 30 minutes. Uncover and bake until the top browns, about 15 minutes more.