Heat the olive oil in a large pot or Dutch oven over medium-high heat. Add the onion, carrots, and celery. Cook, stirring occasionally, for 5-7 minutes, until the vegetables have softened.
Stir in the minced garlic, dried thyme, and red pepper flakes (if using). Cook for 30 seconds until fragrant, then stir in the tomato paste and cook for one more minute.
Add the rinsed lentils, water, ham bone, and bay leaf to the pot. Stir everything together.
Increase the heat to bring the soup to a boil. Once boiling, reduce the heat to low, cover the pot with the lid slightly ajar, and let it simmer for 45-50 minutes, or until the lentils are tender.
Carefully remove the ham bone and bay leaf. Let the bone cool slightly on a cutting board.
Once cool enough to handle, pull the meat from the bone. Shred or chop the meat and discard the bone and any large pieces of fat. The internal temperature of the ham should reach 145°F (63°C).
Return the shredded ham to the soup. Taste and season with salt and pepper as needed. The amount of salt will depend on the saltiness of your ham bone.
Ladle the soup into bowls and garnish with fresh parsley before serving.