After he finished The Lord of the Rings, Tolkien set about revising the stories of the First Age, which would come to be published by his son Christopher as The Silmarillion.  In the process, he wrestled with some significant questions he had not put much thought to before, including the nature of orcs.