Put the beans in a medium-sized pot. Add water to cover the beans, then add 1 teaspoon of oil, salt, the onion, and the garlic. Bring to a boil, then cover and simmer on low for 20 minutes, until the beans are very soft. Do not drain them.
In a heavy-bottomed pot or wide skillet with high sides, heat the remaining 2 tablespoons of oil over medium-high. When hot, add the sprig of rosemary and the dried chiles. Cook until they're fragrant and sizzling.
Turn the heat to medium-low and use a slotted spoon to transfer the beans from their pot to the new, hot one. Use a heavy spoon to smash the beans into a paste, leaving them as textured or smooth as you'd like.
Ladle in about 1/4 cup of the bean-cooking water into the pot of partially-smashed beans. Cook, stirring, until the water has reduced. Repeat this process once more: Your beans should be stewy but not soupy, and not at all dry (if they are, add some more liquid). Taste and adjust the salt. Remove the chile pods and rosemary sprig. Squeeze the lemon over top, stir to combine, and serve.