Theory of spin magnetic quadrupole moment and temperature-gradient-induced magnetization