@Remellion suggested in a comment, less than an hour ago, for a directmate joke problem in which the key is to capture a ghost rook in order to prevent ghost castling as a defence.
As such, I decided to try to make such a problem just for fun. This is what I came up with.
[Title "Black To Play And Mate In Four Moves, White Odds Of No Ra1"]
[FEN "r6B/1p2p3/8/8/8/3p1k1p/3P4/4K3 b - - 0 1"]
1. Ra1+! Bxa1 2. h2 Bd4 3. h1=Q+ Bg1 4. Qxg1#
EDIT: Many thanks to @Remellion for pointing out a flaw in my original diagram!
EDIT: I believe I have fixed the Rb8 cook. Many thanks go to @Evargalo for showing that Rc8 is not a cook, as follows from their comment: 1...Rc8 2.Bc3 h2 3.0-0-0 Rb8 4.Bb4! And there is no mate to follow in one move.
If Black attempts to push their pawn first, White can simply ghost castle and prevent checkmate in the specified length, although they are still losing either which way. Thus, Black must capture the ghost rook, and ONLY then may they push their pawn.
Now, White can't ghost castle to escape. They try to delay their life but it is futile. They are soon checkmated by a promoted Black queen or rook.
I do like how this idea can achieved with such economy of a mere total of just 9 pieces, and how it can be extended to a four-mover.
Also, I suppose the way these "ghost" rooks work is that they ARE OTB technically, but they are invisible, can be moved through, and they can't interact, i.e. moving or attacking, with everyone else, all like a real ghost. But other pieces can chose to not interact with it by sitting on the square, or a one-time capture of the ghost rook is announced.
The technicality here is that since the rook is still there, and that castling counts as like king move, the ghost rook can be moved without ever technically moving on it's own. As such, interesting problems, such as mine, can arise.
An interesting concept that arises from this definition of a ghost rook is that a piece can capture two enemy pieces on the same square. If White's a8 rook moves to a1, a Black piece can actually do a "double-capture" on a1, and take both rooks at the same time.
While these rulesets can be applied to any "ghosted" piece, minus the king of course, the rook is the only interesting case due the castling possiblties that there are to explore.
UPDATE: I found a nice problem from 1949 by Karl Fabel that incorparates both kindside and queenside ghost castling.
This comes from the Russian chess site SuperProblem. (In order to find the image there, go to the fourth heading (Headings) on the top from the left. When a small list pops up under it, click the fourth option (Unusual Tasks) down from the top. When that leads to a lists, click the third option (Tasks with additional conditions) starting from the list, and then scroll down until you find it,)
It may be in Russian, but I can understand chess notations. It’s clear what is does say (or ast least it is clear to me). The problem’s stipulaition is “Retract White’s last move and mate in two.”
Presumably, the Russian wording explains as follows: White gave rook odds on both sides, so they have the right to ghost castle in both sides. Therefore the rook seen on the board is a promoted piece. The solution is retract White ghost castling kindside, and then to ghost castle queenside. Black only legal move is 1.. Ka1, and then White mates with 2. Ra3#.
A very witty chess problem indeed!
P.S.-You can see two more ghost castling problems in the Schwalbe PDB-ID numbers P1182119 and P1146960.