Rooks trapped by diagonal pawns. Bishop sacrifice. Always look for check!

An arbitrary sacrifice like your 17th move won't work unless there are unusual circumstances to justify it, like if you have a lot of pieces near the king that are ready to join in the attack (in this case your only backup attacking piece here, your KN, could only attempt to join in by 19...Ne4, but 20. Bxe4 would kill its participation real fast!) or if your opponent is in a particularly compromised position for some reason. I misunderstood that principle for many years. Those dazzling sacrifices you see in master games are the culmination of a lot of work throughout the game to put the opponent under sufficiently high pressure to make such a sacrifice work. I think of it as putting a lot of weight on a pane of glass, then the sacrifice that initiates the winning combination is like a tiny tap on the glass that causes it to shatter, whereas under normal conditions that tap would do nothing.
White's knight threats on moves 20 and 22 are the result of your earlier unsound sacrifice. At that point you weren't developed enough to defend yourself properly. Possibly you should have traded queens when you had a chance, since you were already 1 pawn ahead from White's mistake on the 11th move, so losing the equivalent of 1 pawn from your sacrifice (2 pawns - 1 bishop = 2 - 3 = 1 pawn behind) leaves you even in material. In other words, in answer to your question at move 22, there was nothing you could do at that point, I believe. The weak moves preceding that position were to blame.
I didn't mind the bishop sac since the board was locked up and there was no obvious moves to make, and I was already ahead a piece. So, I had some breathing room, and white's terribly compromised position led to his defeat.
I agree the sac might not work in higher levels, but at 1300, games are not that efficient. 1 pawn will make much less of a difference when so many mistakes are being made. Hell, I got forked for my rook, and still won.
I didn't trade queens b/c I was at 5:00 left un a 15:00 game. I was running out of time, and no way would have lasted to an endgame. So, I kept the Q knowing I would need a mate to win.