Python 3, 5556 bytes
def f(a,d):
try:x,y,*a[*z=a;a[:]=*a]=*z,*d[a[0]];f*d[x];f(a,d)
except:0
This function take input as a list of chars, and a dict of char to list of chars. And it returns by modify a
in-place.
And if terminating the function by an exception is allowed, it could be even shorter:
Python 3, 3940 bytes
def f(a,d):x,y,*a[*z=a;a[:]=*a]=*z,*d[a[0]];f*d[x];f(a,d)