Stockfish does plan around the 50-move rule. Here's a quick demo (it is silly):
https://lichess.org/analysis/8/1p3K2/kPp5/2P5/2P5/1p6/1P1Q4/...
It's not visible on the board itself, but this position's 50-move rule counter is set to 98 ply -- two ply short of a draw. (That's the 2nd-to-last-field in the FEN representation -- the editable text field just below the board, and also in the URL). The only way to avoid that draw, as Stockfish does in fact suggest, is to a sacrifice a piece in a specific and ridiculous way, to compel black to re-capture on the 100th ply (captures reset the 50-move rule). If you edit the 50-move counter down, Stockfish instead shows you the simple mate-in-3.
Nakamura famously tricked a different chess engine, relying on this 50-move draw avoidance (as one component of the hack) -- a sibling thread is discussing that example:
https://news.ycombinator.com/item?id=27189718