B anomalies and dark matter: a complex connection