Not necessarily. The index fund is supposed to track the index. It doesn't need to actually buy the exact stocks as the index, though in the case of the S&P 500, that might be the easiest strategy.
[0] https://www.spdrs.com/library-content/public/SPDR_500%20TRUS...