The transeverse (up-down) photonic clock is one type of clock. The longitudinal (forward-backward) photonic clock is another type of clock.
It's perfectly reasonable to imagine that clocks would be affected by motion, and that different types of clocks would be affected differently. For example, a pendulum clock will be affected if you take it on a sailing ship across the Pacific. So will a mechanical spring clock, and the effects on the two clocks will be unequal.
However, we think that all inertial frames of reference are equally valid, so we only expect such effects due to accelerations, not inertial motion. Both the transverse light clock and the longitudinal one are moving inertially, so we expect them to agree. (A person aboard the spaceship also sees the spaceship as being at rest, so in this frame there is no meaningful distinction between the longitudinal and transverse directions.)
If SR is to be interpreted as describing spacetime itself, and time dilation as an effect on time itself, then it's necessary for *all* clocks to agree (once we eliminate trivial reasons like random error and accelerations that jar their mechanisms).
All of these considerations are independent of the details of the two clocks, but there's also a simple way to see that the two light clocks must give consistent results, without doing any algebra. In the spaceship's rest frame, let's say that two rays of light are emitted at the same time in perpendicular directions, from the same location. That is, the two clocks are synced, and they also touch at one end. The emission of the two rays is event A. If the two clocks have equal lengths, then the rays are clearly received again after one trip at exactly the same time and place, at event B. Applying a Lorentz transformation can change the time from A to B, but it can't change the fact that the times taken by the rays are equal to one another.