の versus こと in head-internal relative clauses


I'm sure something similar to this has been asked already, but I'm hoping this
is a little different. I imagine the nominalizing usage of の is related to its
noun modifying usage, like:

> 食べる **の**

versus

> テーブルの上にリンゴがあった **の** を食べた

but in the first case the usage of こと is permitted, while in the latter it is
not. Assuming these are these are the same の, why can't we use こと in both
cases? Is it something like the の usage came about first, and later the こと
usage was added?




According to
[Wikipedia](https://ja.wikipedia.org/wiki/%E5%8A%A9%E8%A9%9E#.E6.BA.96.E4.BD.93.E8.A8.80.E5.8A.A9.E8.A9.9E)
(Sorry, I couldn't find more reliable source) the の you've described is the の
of 準体言助詞 .

It seems that this usage of の would magically work as if it were
「こと」「もの」「ところ」, or whatever the appropriate.

To answer your question of "Why can't こと be used instead of の?" the answer is
"Because の has special gramatical usage that can substitute 「こと」「もの」「ところ」 or
whatever".

