Sort and soak cold. Sort the dried beans, remove damaged beans and debris, and rinse well. Cover with the soaking water in a large bowl with room for expansion. Cover and refrigerate at 40°F (4°C) or below for about 12 hours.
Drain and start fresh. Discard all soaking water, rinse the beans again, and drain. Place in a large pot with the fresh cooking water and bay leaves. The beans must remain covered; use additional hot water if evaporation makes that necessary.
Boil before simmering. Bring to a full boil and keep boiling for at least 30 minutes, starting the timer only when the pot is actually boiling. Watch the water level and leave boil-over headroom. Do not taste undercooked beans. Then lower the heat and simmer gently until the centers are fully creamy but most beans still hold their shape. The source's 50–70-minute bean-cooking range is an overall guide including the initial boil; older or different beans can take longer. Do not use a slow cooker for the initial raw-bean stage.
Reserve liquid and drain. Reserve slightly more cooking liquid than the full baking allowance, keeping the extra for small moisture corrections. Drain the tender beans carefully and remove the bay leaves. The reserved liquid comes from this same pot and is not extra broth to count twice.
Soften the onions slowly. Warm the sunflower oil in a wide skillet over medium-low heat. Add the thinly sliced onions with about one-third of the salt. Cook gently for 25–30 minutes, stirring regularly, until very soft, translucent, and lightly golden. Do not fry them dark or crisp.
Add garlic, then paprika off heat. Stir the garlic through the onions for their final minute of cooking. Remove the skillet fully from the heat. Stir in the sweet paprika, pepper, and remaining salt. Use roughly one-quarter to one-third of the listed baking-liquid allowance to loosen the onion mixture, stirring promptly so the paprika does not scorch.
Heat the oven and layer. Preheat a conventional oven to 375°F (190°C). Use a wide, fairly shallow baking dish about 12 × 9 inches (30 × 22 cm). Spread a thin layer of beans, then some onion mixture. Continue alternating, ending mostly with beans and a few visible onions. Lift gently rather than crushing the beans.
Add the remaining allowance. Distribute the remaining listed cooking-liquid allowance gradually at the edges and over the surface. The mixture should look moist without the beans floating in soup. Keep the separate extra reserved liquid for correction rather than pouring it in automatically.
Bake uncovered. Bake on the middle rack for about 45 minutes. Check after about 35 minutes. If both the surface and the beans underneath are drying, add a small splash of hot extra reserved cooking liquid at the edge. Keep the final baking uncovered so excess liquid can evaporate.
Check a creamy finish. The top should be lightly browned and most free liquid reduced. Underneath, the beans should remain creamy and moist, with recognizable grains. A dry, crumbly mass or a loose soup needs correction before serving. Do not bake longer merely to make the surface very dark.
Rest and serve. Rest for 10 minutes after baking so the remaining liquid settles. Divide evenly according to the servings shown. Serve warm as a substantial side or a meatless main dish with bread and fresh or pickled vegetables.