Place chickpeas in a large pot and cover with lightly salted water by at least 2 inches. Add unpeeled garlic, onion, and rosemary. Cover and bring to a boil over high heat. Reduce heat to a bare simmer and cook, topping up with water as necessary to keep beans submerged, until beans are very tender and creamy with no graininess left, about 2 hours. Beans can also be cooked in a pressure cooker at low pressure for 30 minutes. (See note if using canned beans.) Discard onions, garlic, and rosemary. Drain beans, reserving beans and liquid separately. You should have 4 cups drained chickpeas and at least 1 ½ cups chickpea-cooking liquid.
In a medium saucepan, combine oil, garlic, and red pepper flakes and set over medium heat. Cook, stirring, until garlic is lightly golden, about 3 minutes. Add 3 cups chickpeas and chickpea-cooking liquid (or liquid from the cans) and bring to a simmer. Remove from heat and, using an immersion blender, blend to a smooth, saucy purée, adding more chickpea-cooking liquid (or water or vegetable broth) if too thick. Stir in remaining 1 cup chickpeas, crushing some lightly with a wooden spoon or potato masher but leaving them mostly whole. Season with salt and pepper.
In a pot of salted boiling water, cook pasta until just short of al dente. Reserve 1 cup of pasta-cooking water, then drain pasta. Return pasta to pot and add chickpea sauce along with ¼ cup of reserved pasta-cooking water. Set over medium heat and bring to a simmer, stirring until pasta is al dente and sauce has thickened just enough to coat pasta, about 3 minutes; add more reserved pasta-cooking water, 1 tablespoon at a time, if sauce becomes too thick. Remove from heat, stir in chopped parsley and drizzle in some fresh olive oil, stirring to blend. Season with salt and pepper. Spoon pasta and sauce into bowls, garnish with chopped parsley, and serve.