Your main issue seems to be how Japanese can tell the difference between "これを見た電車の中で" and "これを見た。電車の中で". Well, uh, they can tell because in the latter case the two sentences are separated by a period (in writing), or by a pause (when spoken). You could just as easily come up with any number of examples in English where two phrases mean one thing when they come right after each other, and something else entirely when they are two separate sentences.
So what about the case you mention when the speaker is speaking rapidly and the pause between sentences is very short or elided entirely? The answer is that the intonation is different in the two cases. I am not a expert on intonation and do not know the correct technical words to describe this effect, but a stand-alone sentence would end with a downward intonation:
whereas when the phrases were combined, no such downward intonation would be present
Even if no pause were present, but yet the two phrases were intended as separate sentences or utterances, the downward intonation would still be there:
the listener would parse this accordingly, resulting in something like the following:
I saw it--in the train.
The train I saw it in
You may want to study the grammatical notion of relative clauses in general. The issues are whether a "complementizer" or "relativizer" or "relative pronoun" (such as "that" or "which") is used, and where the relative clause is placed (before or after what it modifies). Japanese is a so-called "head final" language, placing the relative information before the noun ("head"), and is by no means unique. Other languages adopting a similar approach include Tibetan and Navajo, for instance.
On a final note, you may have run into toy English sentences such as "The mouse the cat the dog chased ate was gray". Hmmm, that takes a while for anyone to parse. In Japanese, we have
This sentence is far easier to understand, by virtue of the fact that the head-last structure groups each actor and its action or together in a more comprehensible way.