Can the length contraction formula be derived where the photon does
not bounce back to the original mirror?
In the derivation here that you linked to in a comment, the result is obtained using the relationship between coordinate time $t$ and proper time $\tau$ (time dilation):
$$t = \gamma \tau$$
Thus, in the thought experiment, there must be a proper time to apply this formula to. In the case of the linked derivation, the proper time is $t_0$, the two-way time of flight of the photon. This time is measured by one clock co-located with one of the mirrors.
However, the one-way time of flight of the photon, in the rest frame of the mirrors, is not a proper time since the one-way trip time must be measured by two, spatially separated and synchronized, clocks; one clock co-located with one mirror and the other clock co-located with the other mirror.
This difference is this: all observers agree that the two-way time of flight of the photon, as measured by a clock co-located with one of the mirrors is $t_0$. This is why this elapsed time is a proper time; all observers agree that you've measured the two-way time of flight of the photon in the rest frame of the mirrors and that's why we can apply the time dilation formula above.
But, while the two clocks, one co-located with each mirror, are synchronized in the rest frame of the mirrors, they are not synchronized according to relatively moving observers.
That is to say, relatively moving observers do not agree that you've measured the one-way time of flight of the photon in the rest frame of the mirrors and so, the time dilation formula above cannot be applied.
(Additional remarks on the derivation of time dilation and length contraction)
In the case of time dilation, we consider two (distinct) events that are co-located in space in an inertial reference frame (IRF).
For example, an inertial clock emits a photon and then later, receives the reflected photon. In an IRF in which the clock is at rest, these two events have the same spatial coordinate, i.e., the events are co-located in this frame.
As observed from a relatively moving IRF, these two events are separated in both space and time and thus, according to the Lorentz transformations, the elapsed time in this IRF must be greater than the elapsed time on the clock (the proper time). This is time dilation - moving clocks run slower.
Conversely, in the case of length contraction we consider two events that are co-located in time (the events are simultaneous) in an IRF.
For example, the length of an object at rest in an IRF is measured by simultaneously recording the location of each end of the object and taking the difference (proper length).
As observed from a IRF relatively moving parallel to the object, these two events are separated in both time (the events are not simultaneous) and space and thus, according to the Lorentz transformations, the spatial separation of the two events must be greater than the proper length. This is length contraction - moving objects are contracted along the direction of motion.