Modified move-order in the KID 4. ..0-0. What is the point and how to react? A main line in the King's Indian Defense is this 1. d4 Nf6 2. c4 g6 3. Nc3 Bg7 4. e4 d6. However,  black could castle instead of d6:

[FEN " "]
1. d4 Nf6 2. c4 g6 3. Nc3 Bg7 4. e4 O-O


Is this a more-or-less inconsequential move order inversion or does white need to be careful to avoid some pitfall?  

Specifically, in the usual mainline I would play the Sämisch Variation (5. f3) and it does not feel quite right to play f3 there right away, but maybe it is? If not, what should one do as a Sämisch player, Be3 right away? 

Or, is this 4. ... O-O an error that white can try to exploit? If so, I assume the refutation ought to be 5. e5. But is this is good idea? 

I am most interested in answers geared towards Class A or B players, but will be grateful for any input.
In the vast majority of the cases, 4....d6 and 4....0-0 transpose into each other.

However, with 4....0-0 black keeps the option of playing c6 and d5. Recently, this idea has been played by GM Jobava, known for his original approach in the opening: Lupulescu-Jobava, So-Jobava and Vitiugov-Jobava.

About the last game, chess.com comments "Just giving away the g6-pawn. This reporter is at a loss". The engines do not approve Jobava's opening, but somehow he was able to create enough counterplay and to draw the game.

As you play the Sämisch, it makes sense to start with 5.Be3, as Ng4 is not possible. Clearly, 5....d6 6.f3 would transpose to your repertoire. After 5....c6, white has two popular ways to seize the initiative and to obtain an advantage: 6.e5 Ne8 7.f4 d6 8.Nf3 (e.g. Parligras-Fier) and 6.f3 d5 7.cxd5 cxd5 8.e5 Ne8 9.h4 (as in Vitiugov-Jobava). The former should result in a slight but stable advantage for white, while the latter leads to sharper play.



      [StartPly "7"]

      [FEN ""]
      1.d4 Nf6 2.c4 g6 3.Nc3 Bg7 4.e4 O-O (4...d6) 5.Be3 (5.f3) c6 (5...d6 6.f3) 6.f3 (6.e5 Ne8 7.f4 d6 8.Nf3) d5 7.cxd5 cxd5 8.e5 Ne8 9.h4