Electroweak baryogenesis in two Higgs doublet models and B meson anomalies