The two are related, yes, but technically it would be more
accurate to say it the other way around:
"Neutrons are heavier than protons because down quarks are
heavier than up quarks"
Neutrons are composed of an up quark and two down quarks (udd).
Protons are composed of two up quarks and one down quark (uud), so
the difference in mass between a proton and neutron is (roughly)
the same as the difference in mass between the neutron's down quark
and the proton's matching up quark.
Because a down quark is heavier than an up quark, it is also
possible for a down quark to decay into an up quark (releasing an
electron in the process). This is how beta radiation occurs in
atomic nuclei. One of the neutrons' down quarks decays into an up
quark, changing that neutron into a proton, and releasing an
electron (as radiation), so another way to look at it would be that
a down quark is an up quark that has an electron trapped inside it
(the mass of the electron, plus the energy required to "trap" it
there, is what makes the down quark heavier).