Holy cow... That's got to be one of the strangest spinoff origins ever. Who's going to get the creator credit, Marlowe or Castle?
I'm trying to think of another instance where a concept that was fictional in one series got spun off into an actual series of its own. There was that spinoff of
Community's Whovian spoof
Inspector Spacetime into a web series, but they weren't legally able to use the name so they had to genericize it. And there's
Mork and Mindy, which spun off from a
Happy Days episode that was originally just a dream, but got retconned into a real event when M&M was spun off; a rerun of the episode just before the M&M premiere had a new ending added that revealed the "dream" was real after all.
And then there's the case of
Fearless Fosdick. It started out as a strip-within-a-strip in A Capp's
Li'l Abner, a satirical parody of
Dick Tracy that was Abner's favorite comic strip, but it took on a life and a fan following of its own. It never actually spun off as an independent comic strip, but became a semi-regular feature within
Abner, got a TV spinoff of its own (while
Abner itself only got a movie, although its "Shmoo" character was used in Hanna-Barbera cartoons in '79-'80), and was licensed for use in advertisements for a popular hair oil.
Oh, and of course there's
Buzz Lightyear of Star Command, a cartoon that I guess was supposed to be the show that the toy of Buzz Lightyear was based on.
And I know that my fellow Trek novelist Dayton Ward has been trying to convince Pocket to let him do a
Captain Proton series...
Come to think of it, this isn't so rare as I thought.