Anomalies in B-meson decays and the muon g−2 from dark loops