Functoriality and the inverse Galois problem