Heat ¼ cup olive oil in a Dutch oven or large pot over medium-low heat until shimmering. Add 4 minced garlic cloves, 1 tablespoon finely chopped fresh rosemary leaves, and ¼ teaspoon red pepper flakes if using. Cook, stirring occasionally, until fragrant, about 1 minute.
Stir in 3 tablespoons tomato paste and cook, stirring occasionally, until darkened in color, fragrant, and beginning to stick to the bottom of the pot, 4 to 5 minutes.
Stir in 1 (32-ounce) carton low-sodium chicken broth and 1 ½ teaspoons kosher salt. Bring to a boil over medium-high heat.
Stir in 2 (about 15-ounce) cans drained and rinsed chickpeas and 8 ounces dried ditalini pasta. Cook, stirring regularly to prevent the pasta from sticking, until the pasta is al dente, about 10 minutes.
Stir in 4 cups coarsely chopped hearty greens in the last 2 minutes of cooking if desired. Taste and season with more kosher salt as needed. Serve garnished with finely grated Pecorino Romano cheese if desired.
