You are right, they are independent variables, and changing one does not automatically change the other
Yes, they are independent, but the conventions used in the industry are confusing. Ophthalmologists use positive cylinder and optometrists use negative cylinder. Conversion is not as simple as flipping the sign. The axis flips by 90 degrees, and the sphere changes as well.
And with contacts and in some cases with IOLs cylinder is not corrected, but instead partially compensated by changing the sphere power. Spherical equivalent is used which is the sum of sphere plus 50% of the cylinder. In contacts which require lower amounts of cylinder correction, a non toric can be used with minimal loss in visual acuity.