Heat the olive oil in a large pot or Dutch oven over medium-high heat.
If using ground beef, add it to the pot and cook, breaking it up with a wooden spoon, until browned and cooked through, about 5-7 minutes.
Add the onion, carrots, and celery to the pot and cook, stirring occasionally, until the vegetables are softened, about 5-7 minutes.
Add the garlic, oregano, thyme, Calabrian chilies or red pepper flakes (if using), and a pinch of salt and pepper. Cook for 1-2 minutes, until fragrant.
Stir in the tomato paste and cook for 2-3 minutes.
If using, add the white wine and cook for 1-2 minutes, allowing the wine to reduce slightly.
Pour in the broth, marinara or crushed tomatoes, and the drained and rinsed cannellini beans. If using, add the Parmesan rind, bay leaf, and rosemary sprig.
Bring the soup to a boil, then reduce the heat and let it simmer for 20-30 minutes, allowing the flavors to meld.
Remove the Parmesan rind, bay leaf, and rosemary sprig (if used).
Add the pasta and kale or escarole to the pot and cook until the pasta is tender and the greens are wilted, about 10-12 minutes.
Stir in the lemon juice and taste, adjusting seasoning with salt and pepper as needed.
Serve the pasta e fagioli hot, topped with grated Parmesan cheese and crusty bread on the side. Garnish with fresh basil, if desired.
