Either you're confused or I am. TeX and LaTeX are not aware of rivers. (Nor of lakes, though I would guess that the TeX line-breaking algorithm makes lakes very rare.) The comment you were replying to was saying that TeX does do hyphenation and line-breaking cleverly but doesn't detect rivers and lakes; it looks like maybe you thought it was saying that TeX doesn't do any of those things.
I have an old TeX reference which suggests TeX pays attention to rivers. But based on your challenge, I skimmed through the description of the line-break algorithm in Knuth's "The TeXbook," and found nothing about rivers. (There is a bit of attention paid to making sure adjacent lines are compatible in terms of how squashed or spread out they are, but apparently nothing that tries to catch rivers.)
Right. I think the TeXbook explicitly says that TeX doesn't know about rivers, but I forget; anyway, I've read the code, and there is no river detection in TeX.