Strategies for independent learners to identify gaps in their knowledge
First off, it's worth mentioning that everybody has these "blind spots" or gaps in their knowledge. Nobody can know everything, and some of the smartest people I've met are very open about that fact. I think a big part of being a good programmer is being comfortable with the unknown. What makes a good programmer isn't that they can write code, it's that they can learn how to write code.

In that regard, a self-learner already has a lot going for them. Because it's not really about memorizing stuff: it's more about the ability to do research, consult documentation, try stuff out, and see what happens. So the best thing somebody can learn is the ability to learn, if that makes sense.

I'll also say that for me, the thing that really took my knowledge to the next level was when I started answering questions. So I'd say your recommendation of checking out posts on Stack Overflow is on the right track, but I'd encourage novice and intermediate programmers to go a step further and try to answer questions as well. If Stack Overflow seems overwhelming (it was for me at first), then maybe join a forum and start answering questions there. 

If you're only familiar with if statements, then start answering questions about if statements. Eventually you'll see a question that also involves a for loop, so to answer that question you do some research on for loops. Then you start answering for loop questions, and eventually come across a question about functions... That's a contrived example, but the general flow is pretty much exactly what I experienced. Even after a formal education, it really opened my eyes up to how much I didn't know!

Find a community, share your work, talk about programming. This is one way the gaps get filled in with a formal education, so it stands to reason that this would help with a self-learner as well.