Absorbing photons into melanin pigment and dispersing their energy as vibrational motion (heat) doesn't help synthesize vitamin D. For the synthesis you need the photons to hit an intermediate molecule in the pathway and boost an electron into an excited state. If there's a bunch of melanin absorbing photons before they get to the synthesis pathway, the synthesis will be inhibited.
Less sunlight being absorbed by eumelanin in the skin means more sunlight left to be converted to vitamin D. Window glass also blocks most of the UVB part of the sunlight that would be converted to vitamin D.