UFL quadrature degree error

I actually do not want to mix quadratures, but fenics does that somehow, internally.

I just created a MWE for this

from fenics import *
from ufl.algorithms import expand_derivatives
from ufl import replace
from ufl.algorithms.compute_form_data import  estimate_total_polynomial_degree
import numpy as np



mesh = UnitSquareMesh(10, 10)
dx = Measure('dx', mesh)

W = FunctionSpace(mesh, 'CG', 1)
W_vec = VectorFunctionSpace(mesh, 'CG', 1)
V = TestFunction(W_vec)
x = SpatialCoordinate(mesh)

f = Expression('pow(x[0],2) + pow(x[1],2) - 1', degree=2, domain=mesh)
idx = f.id()

u_expr = Expression('sin(2*pi*x[0])*sin(2*pi*x[1])', degree=1)
u = interpolate(u_expr, W)
v_expr = Expression('x[0]*x[0]+x[0]*x[1]+x[1]*x[1]+sin(x[0])+cos(x[0])', degree=1)
v = interpolate(v_expr, W)

F = inner(u,v)*dx - inner(f,v)*dx
dF_ex = inner(u,v)*div(V)*dx - div(f*V)*v*dx
sd_ex = assemble(dF_ex)
dF_ad = derivative(F, x, V)

### First possibility
material_derivative1 = derivative(F, f, dot(grad(f), V))
material_derivative1 = expand_derivatives(material_derivative1)

### Alternative
f_elem = f.ufl_element()
func_space = FunctionSpace(mesh, f.ufl_element())
argument = Function(func_space)
temp = derivative(F, f, argument)
material_derivative2 = replace(temp, {argument : dot(grad(f),V)})

dF_ad1 = dF_ad + material_derivative1
dF_ad2 = dF_ad + material_derivative2

### Fails
# sd1 = assemble(dF_ad1)
# sd2 = assemble(dF_ad2)

### Works
sd1 = assemble(dF_ad1, form_compiler_parameters={'quadrature_degree' : estimate_total_polynomial_degree(dF_ad1)})
sd2 = assemble(dF_ad2, form_compiler_parameters={'quadrature_degree' : estimate_total_polynomial_degree(dF_ad2)})

assert np.allclose(sd_ex[:], sd1[:])
assert np.allclose(sd_ex[:], sd2[:])
assert np.allclose(sd1[:], sd2[:])

The goal is to compute shape derivatives, where u and v are state variables and f should experience a pull-back (similarly to our previous discussion: Shape Derivatives in UFL)

Also, is there any difference between using the replace approach and differentiating directly?