Enhanced stability of defect-based qubits in quantum wells