How to cope with unfavorable GPA algorithm
My university has the same (default) GPA policy.

There is a reasonable argument that the effect you describe is actually desirable. Especially for graduate school, what people are looking for in your grades is not mastery of calculus but rather success in mastering new material.  By that standard, a student who gets an A in calculus on their first attempt has a stronger record than a student who gets a D the first time and an A the second time.

I don't really agree with this argument, in part because I don't think GPA is either so important or so fragile that a single bad grade is actually dangerous.  Grad schools won't care about one D in a freshman calculus class, and your improved grade on a second attempt is good evidence of your ability to recover from setbacks.