If that was the only case I would be happy to take that answer. However, the equality in the first case :
a1=ufl.inner(ufl.grad(u)/x[0],ufl.grad(v))*x[0]*ufl.dx
a2=ufl.inner(ufl.grad(u), ufl.grad(v))*ufl.dx
Makes me think there has to be symbolic simplification somewhere. If it was simply a quadrature problem it would arise in this case too.
In my mind this is linked to Dealing with removable singularities in cylindrical coordinates - #7 by Xuefeng_LIU. In the 1/r singularity case it’s all good, but in the 1/r^2\cdot r it doesn’t work ?