assume f and g are unknown

and assume solve(f, x) = solve(g, x)

f -> a

g -> a

b -> f

b ->g

if assume f = (x+1)*(x+2), g = (x+2)*(x+3)

and a = (x+1)*(x+2)*(x+3)

would like to find map from (x+1)*(x+2) to (x+1)*(x+2)*(x+3)

is it the solution subs(x=(x+1)*(x+2),(x+1)*(x+2)*(x+3)) by composition?

subs(x=(x+1)*(x+2),(x+1)*(x+2)*(x+3))

subs(x=1, (x+1)*(x+2));

subs(x=2, (x+1)*(x+2));

subs(x=1, (x+1)*(x+2)*(x+3));

subs(x=2, (x+1)*(x+2)*(x+3));

6 -> 24

12 -> 60

subs(x=1, ((x+1)*(x+2)+1)*((x+1)*(x+2)+2)*((x+1)*(x+2)+3)); # not 24

subs(x=2, ((x+1)*(x+2)+1)*((x+1)*(x+2)+2)*((x+1)*(x+2)+3)); # not 60

it seems composition is wrong

more difficult and general case should be

f(x,t) -> a(x,t)

g(x,t) -> a(x,t)

b(x,t) -> f(x,t)

b(x,t) -> g(x,t)

solve(f(x,t), x) = solve(g(x,t), x) = in terms of t