In a deep, heavy-based pot, cover the beans with 6 to 8 cups cold water. Add the thyme, garlic, onion, carrot, and 1 tsp. salt. Bring to a boil over high heat. Reduce the heat to a gentle simmer, skimming any foam that rises to the surface. Cover and cook until the beans are tender, about 90 minutes; let cool in the broth.
In a large bowl, combine the shallot, anchovies, vinegar, 1/2 tsp. salt, and 1/4 tsp. pepper. Whisk in the olive oil until well combined. Drain the white beans and add them and the tomatoes to the bowl. Toss to coat the vegetables well with the dressing. Let stand at room temperature for 2 to 4 hours.
Cook the green beans in a large pot of boiling salted water until tender, about 5 minutes. Drain and spread on a paper towels to cool. When ready to serve, add the cooled green beans to the white beans and then the basil, tossing well after each addition. Taste and add salt and pepper if needed.
You can cook the white beans up to a day ahead of assembling the salad. Refrigerated the cooled beans in their broth. and bring to room temperature before assembling the salad.)