TFile gets same pointer for a different key version

You seem to be misusing the concept of the “namecycle”.
When you create different trees, they should have different “names” (the “cycle” numbers are handled by the ROOT I/O automatically).