The best solution would be if JuMP variables work the way Symbolics variables work and extract nonlinear expressions from functions IMHO.
JuMP
Symbolics