Before B2: The Keep On The Borderlands, you have The House On The Borderland.
To quote Wikipedia,
"[The House on the Borderland] was first released in Britain by Chapman and Hall, Ltd. London in 1908. Its most popular version was by Arkham House Press, Sauk City, Wisconsin, in 1946 as part of The House on the Borderland and Other Novels, the same publishers that brought out many books by other authors of weird fiction, such as H. P. Lovecraft."
There are several interesting things about this book.
(1) It was reprinted in 1946, in Wisconsin, by the same publisher that printed weird fiction, in the Lovecraftian vein.
(2) The House on the Borderland left an impression on, and likely influenced, H. P. Lovecraft's writing, and Lovecraftian writing influenced the development of D&D.
(3) It features a protagonist who explores a cave, after having visions of devils and "swine-men" (pig-faced orcs?). He battles several of those swine-men in the cave.
I don't recall seeing either this author, or this book, listed in the infamous AD&D Dungeon Masters Guide "Appendix N". Perhaps it is mere coincidence that there is an early D&D module with a similar name, and that the early D&D orcs are pig-faced.
But I have a hard time believing that there is no link between this book and the early development of D&D.