With this scene I think it’s important to focus on available information.
In RotS there is a Death Star under construction.
In R1 and ANH there is a completed Death Star, 20 years later
In RotJ there is a mostly built larger Death Star, a few years after ANH.
There are no contradictions here.
We honestly don’t know if the DS at the end of RotS and the one in R1/ANH are the same one.
It’s very possible that while building it and running a test that one was destroyed, it’s also possible that it was sabotaged (Tarkin in A New Hope - “there’ll be no one to stop us this time” What is the other time he was talking about and what was stopped that time?).