Heat the olive oil in a large pot over medium heat. Add the onions and a generous pinch of salt and pepper and cook until softened, stirring occasionally, about 8 minutes. Add the smashed garlic cloves (they’ll get blended later) and chopped carrots to the pot and cook about 8 minutes more, stirring occasionally.
Stir in the ginger, then add the apple cider vinegar, and then add 3 cups of broth. Reduce to a simmer and cook until the carrots are soft, about 30 minutes.
Let cool slightly and transfer to a blender. Blend until smooth. If the consistency of your soup is too thick, add up to 1 cup more broth.
Serve the soup with the pesto on the side. Garnish with a drizzle of coconut milk, if desired.