Saying that apartment buildings get an 8-11% annual return is a very generalized statement.
I'll assume that those numbers refer to a buy and hold investment strategy with apartment complexes and are taking in to account the annual return on investment through calculating net profit after all payments and expenses. Generally when you hear numbers like that quoted they are referring to my assumption, so that's what I'll go with even though the statement is so broad that it could refer to anything.
There are so many variables; What type of apartments? What market? Why not SFH or Multis? What about capital appreciation? What about principal payments being applied (gaining more equity)? What about being able to leverage your investments with a mortgage? How about tax benefits?
All of the above aside, real estate investing comes with one major (for me) advantage over the stock markets and that is the fact that I can personally investigate, choose, and manage my investments. That personal touch has allowed me to ALWAYS earn (much) more than I have on my index funds, which I do have and I think are an integral part of my portfolio.
I can assure you that many (probably most) experienced investors on this forum are earning greater than 11% returns. They are doing that all while property prices and rent are increasing faster than inflation, while they have a tenant paying down principle, while enjoying greater tax benefits than with index fund investing, and most importantly while being in direct control of their investments.