You are confused about how constants are treated in different derivative rules. Read on to understand how y should be treated in your two different scenarios:
Consider the first example you gave:
f(x) = x^2 + y^2
[1] Differentiate both side respective to \delta x:
\frac{\delta}{\delta x} f(x) = \frac{\delta}{\delta x}(x^2 + y^2)
[2] Sum rule of derivative: the derivative of a sum is equal to the sum of the derivatives
\frac{\delta}{\delta x} f(x) = \frac{\delta}{\delta x}x^2 + \frac{\delta}{\delta x}y^2
[3] For the first term \frac{\delta}{\delta x}x^2, apply the Power Rule
\frac{\delta}{\delta x} f(x) = 2x + \frac{\delta}{\delta x}y^2
[4] For the second term \frac{\delta}{\delta x}y^2, since y^2 is the constant when differentiate respective to x, its value is 0.
\frac{\delta}{\delta x} f(x) = 2x + 0
Remember that \frac{\delta}{\delta x} C = 0 (which means the constant will never change when we change x). This is why people automatically “ignore” summation terms without x when do differentiation with respect to x.
[5] Simplify:
\frac{\delta}{\delta x} f(x) = 2x
Now consider the second example you gave:
f(x) = 3x^2y^3
[1] Again, differentiate both side with respective to \delta x
\frac{\delta}{\delta x} f(x) = \frac{\delta}{\delta x}(3x^2y^3)
[2] Since y^3 is constant when differentiate respective to x, we can rewrite:
\frac{\delta}{\delta x} f(x) = \frac{\delta}{\delta x}(3y^2 \times x^2)
I think you was confused that y^2 can be ignored here because it can be “ignored” above. This is not correct as the y^2 is part of the whole term 3x^2y^3 (which contains x). We should see that 3y^2 is in fact the whole constant.
[3] Apply the Constant Multiple Rule
\frac{\delta}{\delta x} f(x) = 3y^2\times\frac{\delta}{\delta x}(x^2)
[4] From there apply the Power Rule:
\frac{\delta}{\delta x} f(x) = 3y^2 \times 2 \frac{\delta}{\delta x}x
[5] Simplify:
\frac{\delta}{\delta x} f(x) = 6y^2\frac{\delta}{\delta x}x