Try print(y.grad)… Of course, x has again accumulated two gradients.
In your second example, the accumulation is more complexe, but still simple :
grad(y) = dy/dx = 2,2;        grad(z) = ones_like(y) = [1,1] # call for grad(y,x)
  |                             |
  +                             +
  |                             |
grad(y)=dy/dx*dz/dy = 40,24 ; grad(z) = dz/dy = 20,12 # call for grad(z,y)
  ||                            ||
42,26                          21,13  # call for grad([z,y],[y,x])