Time travel is complicated
The effects of time travel in Harry Potter depend on a variety of factors. As noted on Pottermore (preserved here) traveling back more than a few hours is likely to have serious repercussions.
As our investigations currently stand, the longest period that may be
relived without the possibility of serious harm to the traveller or to
time itself is around five hours.
They even mention this in the play itself:
SCORPIUS: Have you heard me, Albus? This is bigger than you and your
dad. Professor Croaker’s law — the furthest someone can go back in
time without the possibility of serious harm to the traveler or time
itself is five hours.
Of course, in The Cursed Child they traveled back far more than a few hours.
Further, Rowling established the possibility of altering the timeline before Cursed Child, both in Prisoner of Azkaban (as discussed in another answer) and on Pottermore:
What is more, her five days in the distant past caused great
disturbance to the life paths of all those she met, changing the
course of their lives so dramatically that no fewer than twenty-five
of their descendants vanished in the present, having been “un-born”.
In addition, there is the general principle that, as with all things magical in Harry Potter, the ramifications of meddling in fundamental issues of magic can be very unpredictable. As Saul Croaker says on Pottermore:
"Just as the human mind cannot comprehend time, so it cannot
comprehend the damage that will ensure if we presume to tamper with
Basically, sometimes you get a stable time loop, sometime you get a change in the timeline. No one knows why, and that's why it's an excellent idea to avoid time travel.