Dirac gap opening and Dirac-fermion-mediated magnetic coupling in antiferromagnetic Gd-doped topological insulators and their manipulation by synchrotron radiation