Ab-initio theory of orbital and phonon driven relaxation pathways in quantum defects of semiconductors