Savory things tend to need something acidic, and sweet things tend to need something bitter to give them more depth of flavor. If you’re making something with sweet chocolate, vanilla is an important addition, not only because of its intense flavor but also because it’s a little bitter, to balance the sweetness.