That's not true if you sell stock to maintain a certain equity to debt ratio. If you use leverage in the S&P 500 then you have much a faster growth rate, so in the long term it's still better.
Clearly you cannot do math. It all depends on market timing, and if you get that wrong you will go broke as quick as your leverage. If you can get that right, well you would not be posting here, you would own here....
There's a funny story I read a while back about this play. If you did this for long enough eventually you'd be the biggest company in the S&P 500 (technically maybe not, but in practice very much so!).