Bring a large pot of lightly salted water to a boil. Add green beans and cook uncovered until tender but still firm to the bite, 10 to 15 minutes. Drain.
Melt butter in a saucepan over medium heat; whisk flour, ranch dressing mix, and white pepper into butter until a paste-like consistency is reached. Pour milk into butter mixture; cook, whisking constantly, until sauce is thick and bubbly, 5 to 10 minutes.
Spray a nonstick skillet with cooking spray and place over medium heat. Cook and stir onion and garlic in hot skillet until slightly softened, about 2 minutes. Transfer 1/2 of the onion mixture to a plate and return skillet to heat.
Stir mushrooms into skillet with remaining onion mixture; cook and stir until mushrooms are tender, about 5 minutes.
Stir mushroom mixture, green beans, and sauce together in a 1 1/2-quart casserole dish. Stir reserved onion mixture and bread crumbs together in a bowl; sprinkle over green bean mixture.
Bake in the preheated oven until hot and bubbling, 25 to 30 minutes.