9...Bg4 was rushed. A Good thumbrule to note is that you don't pin the knight until he's castled on that side (which in your game, he didn't thanks to your pin!). Doing it early still gives him the flexibility to castle on the other side and he gets to play h3/g4 type moves with tempo (chasing your bishop away with no risk)
Instead of 21...Kf7,doesn't Rxd1 Rxd1 Rxd1 Kxd1 Nxf3 get you back your pawn?
Now trading after the he plays f4 is not so good as you are getting into a classical B vs. N endgame where the bishop has tons of room to dominate the slower moving knight, esp. with pawns on both sides of the board. I'd have tried to play on with my rooks. It helps to know what kind of endgame you are going to be trading down to, so that you can make tradeoffs like "surrendering the open file" (which your rooks/rook may have had to do ) and still having one or two rooks active enough to do stuff.
I see the big 'blunders' (like not moving Ng1+ and forking the h pawn), and probably allowing the Queen exchange instead of moving Qf6. But I'm at a loss as to how I should have been 'planning.' Any advice?