The short is yes they are related. If you dkH is in a normal range, the pH of your tank will depend on the CO2 level in your house. There are some exceptions to this rule, like Calcium reactors and tanks that don't have good enough aeration, but for most it holds true. Worry about your dkH level, not your pH.
Mag helps maintain your Calcium level. If your Mag level drops too low, you'll have problems maintaining your calcium level. Keep your Mag level within the normal range, and then worry about your calcium level. Mag is used up very slowly, so you will test for calcium much more often.
Jeff