Because the time dilation formula can in fact be derived directly from the Lorentz transformation. See, e.g. this link.
Special relativity is often first presented as a sequence of "effects" with their own formulae, sometimes justified with an accompanying thought experiment. This is useful pedagogically, and in some ways can aid the student in seeing how the theory makes sense intuitively.
But just about all special relativistic physics is encoded in the geometry of Minkowski space and the Lorentz transformations thereupon. Starting from these geometric principles, it is possible to unify and derive all the individual results that have been presented separately, like length contraction, time dilation, and velocity addition.