You could actually have trapped the queen in the same way as early as move 10 mate, so your opponent definitely didn't realise this was possible.
What you describe is I think a bit of experience and also how well you can analyse. If your opponent makes a move and you immediately think 'blunder!' try not to get too excited. Be very suspicious of receiving gifts, and of course the stronger your opponent, the more suspicious you should be. All of us have lost games where we fall into a trap...it's annoying! Painful experience teaches caution. Also some experience of certain situations. For example, there are times when you can win a pawn on the edge of the board. A free pawn is a free pawn right? And your opponent doesn't seem to be threatening anything...but it may turn out that certain threats can be generated long term, or that your position becomes extremely awkward to play because you spent time moving a piece away from the action to capture what turns out to be a pretty insignificant pawn. We're talking 10 moves later, past the point you can analyse to. These 'poisoned pawns' are named so for a reason and the more experience you gain the better feel you have for when they can/should be captured and when not.
After that it comes down to the strength of your analysis - if you play it through over and over again and don't see why your opponents move is anything but a mistake then that's all you can do. Eventually you just have to say 'OK, I don't see it so show me'. Even if you have suspicions you have to trust yourself if you don't see what the problem is, otherwise all you have left is self doubt and opponents can take liberties by playing dubious stuff that you don't challenge.
I have an example I want to post here but it's a live game, so I'll save it for a bit until I can share it without risking cheating.
I'm new to the game, I was taught by my grandad when I was 8 so I've known how all the pieces move for three decades but only this year (yes....after the queens gambit) have I started to study theory, openings, mating patterns etc. Finally after all these years I realise why I couldn't even beat the crappiest engine on the easiest setting...because literally all I knew was how each piece moved and nothing else.
Something that takes up a LOT of my time at the moment is looking at a move made by a more experienced, higher rated opponent that looks like a complete blunder. In the game that's ongoing at the moment, I was able to put the opposing queen into a trap where, as I saw it, the opponent's best choice was to capture either a bishop or a knight with the queen to reclaim material on her way out.
Instead of using the queen to take a higher rated piece, my opponent simply made a central pawn capture (exd4), leaving me to capture the queen with a bishop (who will then be recaptured with axb6). So my opponent got an extra (and central) pawn for the move and can recapture after losing the queen, but their new pawn on d4 is immediately under attack with no protection.
I know this description of the game isn't going to help anybody give tactical advice (which is intentional - I can share the game and get specific advice after it's ended) but what I'm really interested in is how do more experienced players go about studying or understanding a move that simply looks too good to be true? When you look at the board and can only see a big red blunder from your opponent, how do you reassure yourself (as best you can) that it's definitely soand that you're not wandering into a tra?
I spent a lot of time on the magnus trainer app, and he seems to be particularly in love with GMs who sacrifice queens like it's nothing, so i think he's got me overthinking things a bit now...