Generalized Chain Rules and Applications to Stieltjes Differential and Integral Equations