@christopherchelpka Turns out there are a lot of great articles and videos on castling rules. With regard to the rule I’m talking about, this one says:

Nor can you castle while in check. However, you can castle with a rook that is under attack at the time, and the rook can pass through an attacked square when castling while the king cannot. (Amusingly, this was once called into question at the highest level, when a top Grandmaster, Viktor Korchnoi, went to confirm with the arbiter that he could castle with his rook under attack during a game with Karpov in 1974.)