I don't believe it's a scam by any means. In fact, for most people who work 9-5 and likely will for 40+ years, it's probably the wisest thing for them to invest in their 401k as early and often as possible. At a minimum, you should at least contribute up to your company match given it's a 100% return on your investment assuming you're vested.
However, if you're someone who is looking to quit your day job and go into real estate full time as soon as you can, maybe you don't invest in your 401k. Certainly depends on your situation and personal goals.
I believe the argument these books/podcasts/gurus are making is that once the money is in the 401k, it's harder to get out without penalties, etc. The idea is the 401k limits what you can invest in based on what funds/indexes your employer allows you too. For many employees, our options are limited to target date funds. We don't have total control of our money if options are limited as to what we can invest in.
Yes, you can borrow from your 401k and pay yourself back. I've done this to buy real estate and assuming you aren't over leveraging yourself, know what you're doing when purchasing investment property, and are OK with a smaller paycheck for the next 1-5 years as you pay yourself back, then it can be a phenomenal strategy.
What I am doing is investing up to the company match, then saving as much money as I can to passively invest in real estate syndications where returns are far in excess of what my 401K has done over the last 8 years and what stock market has done historically.
Yes, you can and should do both.