Like many of similar expressions, this one comes from classic literature but over the years it’s been changed. Originally, you’ll see it in Hamlet’s soliloquy: “…there’s the rub”. So maybe someone thought there was a mistake in Shakespeare’s masterpiece and wrote what he might mean by these words. That’s how the quote appeared the way we come across it nowadays. By the way, “therein lies the rub” means that there lies the problem (a little one).