How to Make It
Cut the onion in half. Keep one half intact and throw it into a large pot. Chop the other half and reserve.
Add the beans and 1 of the garlic cloves to the pot, along with enough water to cover the beans by 3 inches, and turn the heat to high. Bring to a boil, then reduce the heat as low as it will go, cover, and cook until the beans are tender, 60 to 90 minutes.
Chop the remaining garlic clove.
While the beans are cooking, make the sofrito: Pour the oil into a medium sauté pan over medium heat. Add the reserved chopped onion and the chopped garlic and cook until the onion softens, about 5 minutes. Add the tomatoes and chiles and cook until the tomatoes break down, release their liquid, and become very soft, and most of the liquid has evaporated, about 10 minutes. Remove from the heat.
When the beans are tender, sir in the sofrito, increase the heat to high, and cook, uncovered, until the beans are very soft and starting to break apart and the liquid has reduced by about one-third but the beans are still brothy, about 30 minutes. Stir in the salt, taste, and add more if needed.
While the beans are cooking, make the pico de gallo: In a mixing bowl, combine the tomatoes, onion, chile, olive oil, lime juice, cilantro, and salt. Taste and add more salt if needed.
When the beans are ready, divide them among shallow bowls and top each portion with some pico de gallo. Serve hot, with tortillas.