I understand why fianchettoing can be helpful, even deadly to an opponent, but should it really be done on the side which the King castles into? I realize that the King's Indian Defense/Attack involves fianchettoing on the kingside as well as castling to the kingside, for Black and White respectively; and that that position is quite strong. But I'd like to know the principle behind opening up the N-pawn above the castled King. Is it a weak point? And if so, should I be careful not to move my Bishop from the fianchetto square?
I suppose more generally my question is: what should I be careful of when advancing a pawn in front of a castled King in the early to middle game?