WILD WILD GAME!!!
after Kxd2, Nf3+ gets the white rook anyway
Your opponent started shooting on the kingside (10.g4) before you were even there. And then you ran toward the bullets!!
After 10.g4, there is no reason to castle kingside. Your king will be much safer on the queenside.
Next time, when your opponent commits to an attack on one side of the board, castle on the other side.