The reason is that the object created by the scalar–vector product 2*grad(u) has a free index. Every time an object with a free index is created, the global index counter is incremented, to avoid naming conflicts. The reason the index names start at i_8 and not i_0 is that eight indices are already created by default (i,j,k,l,p,q,r,s). You can technically reset the index counter, e.g.,
F1 = dot(2*grad(u), grad(v))*dx
from ufl.core.multiindex import Index
Index._globalcount = 8
F2 = dot(2*grad(u), grad(v))*dx
to pass the assertion, but this is probably not a good idea. In this particular example, you could alternatively define F1 and F2 by
2*dot(grad(u),grad(v))*dx
which avoids creating the intermediate object 2*grad(u), which has the free index.