why not play h4. and then Kh2 before the enemy can do this?
How to keep your fianchettoed bishop?

*Ordinarily* you just have to look ahead a little more. Normally White would merely retreat his bishop to h1 here, but he can't here because his rook would be captured instead, so you just have to castle earlier.
But this game is not "ordinarily." If you count the number of moves that each side has *apparently* made here, it's 7 moves for White, 8 moves for Black. Ordinarily White would be equal or ahead on number of moves. White lost a tempo here by moving the same unit twice in the opening, didn't he? Therefore the mistake lies deeper, not in the position, but in violation of basic opening principles.

sqod- this wasnt a real game, I just put peices in a random position that would look like a similiar situation in a real game. And moving my bishop to h1 seems like a rather bad idea, even if the bishop wasnt pinned to my rook.
4km41-Id rather develop my pieces than spend three move making sure he cant take my bishop. Also moving my pawn to h4 is weaking my kingside as well.
Overall, I just want to know the importance of this bishop and wheither I should spend 3+ moves protecting it or not from someone 1800+ live standard or blitz.

And moving my bishop to h1 seems like a rather bad idea, even if the bishop wasnt pinned to my rook.
Protecting a bishop that way is standard among master games, in my experience. Here's an old thread that says the same thing:
http://www.chess.com/forum/view/game-analysis/quotbackdoorquot-attacks-on-fianchettoed-bishops

huh, Ive watched a good amount of grandmaster games and never seen anyone do that. Im not saying your wrong, I guess I just never seen it before. Ill try this out next time it occurs.

Your fianchettoed bishop is important, so yes, it's worth protecting. It took you an extra move to fianchetto it, and it controls the longest diagonal on the board, and it is critically important to a castled king's defense, so trade it off with care!
Here are three examples...
(1)
{Walter Shawn Browne (?) vs. Elliott C Winslow (?), USA | USA | 1977 | ECO: E80 | 1-0.}
http://www.chess.com/article/view/walter-brownes-best-games
(2)
{Nigel Short vs Jan Timman, Tilburg 53/115 (1991).}
http://www.chessgames.com/perl/chessgame?gid=1124533
(3)
{Robert James Fischer vs Cesar Munoz, Leipzig ol prel (1960).}
http://www.chessgames.com/perl/chessgame?gid=1044124
Retreating the Bishop was played in Reti-Alekhine, Baden-Baden 1925. This is playable if the Queen supports the Bishop on the diagonal, however if supported on the h-file, it allows more tactics based on the discovered attack. The most common treatment is to protect the dark squares with the King after the exchange. There are examples in the marpczy bind where black wants to exchange the dark squared bishops. There are rare examples where the exchange of h6 allows a tactic due to the Queen being taken away from the center.
It seems like every game I fianchetto my bishop my opponent usually gets it by putting his bishop in front of his queen and attacks the h3 square or the h6 square.Its really difficult to stop because usually i cant attack either piece.I know that taking someones fianchettoed bishop weakens their king's protection so I need to improve on this.