In Harry Potter and the Cursed Child play, when you change past, time travellers aren't immune to changes. For example, when Harry got killed in the past, the time traveller Albus also got kicked out of existence. It wasn't like Albus popped into existence in present.
So, why didn't their memories get affected?
In the first alternate timeline (in which Ron and Hermione weren't married):
Albus and Scorpius didn't know that Albus was in Gryffindor. Also, they remembered from original timeline that Albus was in Slytherin.
Albus and Scorpius didn't know that Hermione was a teacher at Hogwarts. Also, they remembered from original timeline that Hermione was Minister.
Albus didn't know that his aunt was Padma and his cousin was Panju. Also, he remembered from original timeline that his aunt was Hermione and his cousin was Rose.
In the second alternate timeline (in which Voldemort won the war):
Scorpius didn't know wizarding history regarding Battle of Hogwarts and he remembered events from original timeline.
Scorpius didn't know that his dad was in ministry. Also, he remembered from original timeline that his dad's position was actually Harry's.
Scorpius didn't know that he was 'Scorpian King' at Hogwarts. Also, he remembered from original timeline that he was a loser at Hogwarts.
I know there's no answer to this as this is a poor way of handling time paradox (why would Scorpian King go to the lake in the first place; Cedric being already alive and without Albus, there wasn't any point of time travel).
I just want to know what trope is this, out of universe. I have encountered such memory switching only once before: In X-men: Days of the Future Past movie. But, in that, Wolverine's consciousness was sent back in time, not body. So, it makes sense.
Due to which trope here in the case of Harry Potter and the Cursed Child, did memory switch happen?