So how is this timeline matching?
It doesn't.
It's just a two part joke thrown in due to fortunate timing and the availablity of the current X-men actors.
It was joke from the first Deadpool movie that the school was empty even though it should be overflowing with recognisable mutants.
At the time this was due, mostly, to the character "permissions" being tightly controlled and budget issues but now this is not such an issue.
However, the previous iterations of the X-men actors aren't available (Jackman a possible exception) but fortunately, the new versions, it so happened, were.
So...
A scripted joke got enhanced...
Director David Leitch told us how the shot came together. “That was interesting because Simon Kinberg was filming X-Men: Dark Phoenix in Montreal at the same time we were doing Deadpool,” he told Den of Geek. “So this was in the script but we were always wondering how we were going to be able to pull it off. The set supervisor, Dan Glass, who did the Matrix films, he came up with this idea of doing a composite, and getting the plates to match.
“So we shot our side here, and we sent the measurements and the camera positions and things up to Simon's team on Dark Phoenix, and they shot the plate for that there,” continued Leitch. “Then we put the two together. So actually it turned out to be easier than we thought. If we would have had to get all those people in the room it probably wouldn't have happened.
Source