First, it is highly unlikely that you will get a definitive answer here since computers are not great in these types of positions where the danger to white might be 10 moves down the road. It is also not uncommon for black to "lose" a rook in this opening, the Classical King's Indian, however, we often find that black's k-side attack is simply too strong in practice.
Computers are not yet strong enough to see this deeply, and even if they could, you are playing a human being. As a practical matter, positions like these, which are so complicated and dangerous, even if technically not correct, they are fine to play in practice...ask Tal. :) Still, you also missed some quicker wins too.
In the line 21.fg Ne4, you clearly have compensation since the eval is only +.7, and falls to about +.4 the move after taking on a8 and the recapture, however, the question is if you can ignore the immediate recapture, and just play something else. I do not think so since white's q-side attack comes too quickly. I think you have to take back immediately, and then bring the queen back to the k-side. If you have to do that, you are right that it is probably wrong.
All of this is a bit moot since the most popular move is 18...h5, which scores at only 33% for white compared to 83% after 18...Bf8. I like the idea of the pawn roller there since it is more flexible when you play g4.
[FEN "rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1"]
1. d4 Nf6 2. c4 g6 3. Nc3 Bg7 4. e4 d6 5. Nf3 O-O 6. Be2 e5 7. O-O Nc6 8. d5 Ne7 9. Ne1 Nd7 10. Be3 f5 11. f3 f4 12. Bf2 g5 13. b4 Nf6 14. c5 Ng6 15. cxd6 cxd6 16. Rc1 Rf7 17. Nb5 (17. a4 {a4 is a more common move here.}) 17... a6 18. Nc3 Bf8 (18... h5 {h5 is a more common move here.}) 19. Na4 Bd7 20. Nb6 g4 21. Nxa8 (21.fxg4 Nxe4 22.Nxa8) 21... g3 22. hxg3 fxg3 23. Bxg3 Nh5 24. Bf2 Ngf4 25. Nb6 Rg7 26.Nxd7 Qxd7 (26... Rxg2+ 27. Nxg2 Qg5-+) 27. Kh2 Nxg2 (27... Rxg2+ 28. Nxg2 Qh3+ 29. Kg1 Qxg2#) 28. Nxg2 Rxg2+ 29. Kxg2 Nf4+ 30. Kg1 Qh3 0-1