"Part of a system" is a question about how someone analyses something by drawing boxes around separate components, rather than about what is actually there.
You can draw a box around just the train, and then you have a moving system that is "open", that lets the photon in. Or you can draw a box around everything, and then you have closed system with parts that aren't uniformly moving.
Both can be reasonable ways to analyze things, if you're careful.
Time dilation (and length contraction) isn't a property of a system. It's a property of an observer's perspective on two "events". These can be the reflection (absorption and reëmission) of a photon in a light clock, but where the photon came from truly doesn't matter. (Though arranging for a photon to be captured from outside a light clock and kept in the right path to remain in it is incredibly difficult.)
If it helps, think of the light as it's own "system", rather than as a part of either the train proper. But the important bit is the events, and those will be the same whatever the photon source.