I believe you see something like
The applicable method may be too new: running in world age 32545, while current world is 32546.
You could try something like
using Symbolics
function test()
@variables x
p=(1+x)^2
f_expr=build_function(p,x)
f=eval(f_expr)
Base.@invokelatest f(1) # get 4
end
test()