To cook the beans: Fill a large pot with water and salt generously. Bring it to a boil. Add the beans and cook until tender, about 5 minutes. Drain the beans, reserving 1 cup of the bean liquid, and cool them immediately with cold water to stop the cooking. (You do not want the beans to overcook, as they will turn to mush.)
To make the sauce: In a large, shallow, heavy-bottomed pan, warm the olive oil over medium-low heat. Add the garlic and let soften, about 5 minutes. Add the chopped rosemary and cook until fragrant, about 2 minutes. Add the tomatoes, a pinch of salt, ground pepper, and the bay leaf. Bring to a simmer and let cook until the sauce thickens, about 20 minutes, stirring occasionally. Season to taste with salt, ground pepper, and red pepper flakes.
To cook the pasta: Fill a large pot with water and salt generously. Bring it to a boil. Add the pasta and cook until al dente, about 5–6 minutes. Warm the sauce over medium heat. Add the beans to it, along with 1 cup of bean water. Once the pasta is cooked, transfer it to the sauce with a set of tongs, bringing a bit of pasta water along with it. You want the sauce to be loose but not liquidy. Toss the pasta in the sauce with the beans for 1 or 2 minutes and then twist nests of pasta into individual bowls. Garnish with a little grated Parmesan, a small pour of good olive oil, and a sprig of oregano.