As you suspected, the origin of the phrase Catch-22 was originated in the Joseph Heller book (1961) of the same name. Heller wrote in the book:
There was only one catch and that was Catch-22, which specified that a concern for oneâ€™s own safety in the face of dangers that were real and immediate was the process of a rational mind. Orr was crazy and could be grounded. All he had to do was ask; and as soon as he did, he would no longer be crazy and would have to fly more missions. Orr would be crazy to fly more missions and sane if he didnâ€™t, but if he was sane he had to fly them. If he flew them he was crazy and didnâ€™t have to; but if he didnâ€™t want to he was sane and had to. Yossarian was moved very deeply by the absolute simplicity of this clause of Catch-22 and let out a respectful whistle.
â€œThatâ€™s some catch, that Catch-22,â€ he observed.
â€œItâ€™s the best there is,â€ Doc Daneeka agreed.
Originally, Heller was going to name the book (and the phrase) Catch-18, but another book, Mila-18 by Leon Uris had just been published and Heller’s publisher felt there might be confusion with the books. It was long after the publishing of the book, that the phrase took hold in American slang.