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?