Chop the onion and optional carrot, mince the garlic, and drain and rinse the canned beans under cool running water. Measure the herbs, tomato paste, and vegetable broth so everything is ready before cooking.
Heat the olive oil in a large soup pot over medium heat. Add the chopped onion and carrot, if using, and cook for 4–5 minutes until softened. Stir in the minced garlic and cook for another 30–60 seconds until fragrant. Avoid browning the garlic too much.
Stir in the tomato paste and cook for about 1 minute to deepen its flavor. Add the diced tomatoes, dried thyme, oregano, and black pepper. Stir well, allowing the tomatoes to blend with the softened vegetables and herbs.
Pour in the vegetable broth and add the rinsed white beans and bay leaf. Stir gently to combine. Bring the soup to a gentle boil, then reduce the heat to low so it simmers without splashing.
Cover partially and simmer for 12–15 minutes, stirring occasionally. The beans will absorb the tomato and herb flavors as the broth becomes richer. For a thicker consistency, mash a small portion of the beans against the side of the pot or blend one cup of soup and return it to the pot.
Remove the bay leaf. Stir in the optional baby spinach and cook for 1–2 minutes until wilted. Add the lemon juice, taste, and adjust the salt and pepper. Finish with fresh parsley or basil and a small drizzle of olive oil. Serve hot with crusty bread.