Trapped Rooks: Does Stockfish penalize more if the king can't castle temporarily? In this talkchess thread, they discuss trapped rooks and castling rights. In post #5, user @Lyudmil Tsvetkov posted:

I would give at least some 10-15cps for temporary prevention of castling.

Here is how StockFish implements it:
score -= TrappedRook * (1 + !pos.castling_rights(Us));

Here an example position.
r3kb1r/pp3ppp/4bn2/3p4/P7/4N1P1/1P2PPBP/R1B1K2R w Kq - 0 1

When searching, the move Bg2-f1 leads to the position.
r3kb1r/pp3ppp/4bn2/3p4/P7/4N1P1/1P2PP1P/R1B1KB1R b Kq - 1 1

As you can see, the White bishop has blocked castling, but pos.castling_rights(Us) for White still returns true, which means Stockfish is not penalizing for the temporary prevention of castling.
Is it intentional or is it a Stockfish bug?
White hasn't lost his castling rights. It's just not a legal move right now. There is a distinction.
White would still be able to castle king-side, if the bishop were to move.