It's one of the classic pieces of advice, 'write what you know'. What it really means is that you should use your own experience of human interaction to inform the behaviour of your characters. It quite definitely doesn't mean limiting yourself to the limits of your objective knowledge, large parts of the science-fiction genre would go unwritten if it did.
What has me wondering is that even the correct interpretation could actually be a bit limiting. I'm white fifty-something and male, and all my life experience is refracted through the lens of that. It's easy and comfortable to write from that perspective and I know from experience it can create some problems when writing. A few years ago I was working on one of many failed novels and about two-thirds of the way through the first draft I realized that all my main viewpoint characters were male. Given the cultural setting of the world I had created that was possibly justifiable, but it just struck me that I was creating this whole imaginary universe and my creativity had fallen short on simply figuring out how to create a decent role for a female character. I tried rewriting some of the plot threads, which marked the beginning of an endless loop of rewrites that eventually collapsed the book under the weight of them.
I don't know how much that potential comfort zone affects other people's writing, but I suspect that it's not that uncommon. Trying not to fall into the trap isn't about political correctness, or trying to reflect current day social values, its about stretching yourself as a writer pushing out beyond what you know and trying something unknown. Better to fail doing that than winding up writing characters who are just endless variations on yourself.