I doubt that there is a single source for “hearts of men” in English. A short and straightforward phrase like this can easily be re-created from its parts.
Ehrenreich’s book is subtitled “American dreams and the flight from commitment” and it is about the changing desires and aspirations of American men in the 1980s. Butler’s novel is about the relationships of two men to their families, friends, and colleagues. I could not see any evidence that either of these books is alluding to anything in particular: in both cases we can take the title as referring literally to the hearts of men (American men in general, in Ehrenreich’s case, and the two protagonists, in Butler’s case).
In the case of ‘Battle Hymn of the Republic’, although “hearts of men” is not itself a biblical quotation, it is placed in a context where it is surrounded by biblical references. The relevant lines are:
He has sounded forth the trumpet that shall never call retreat;
He is sifting out the hearts of men before His judgment-seat
These lines summarize the last judgment in the book of Revelation: in the first line the last trumpet from Revelation 11:15 proclaims “the kingdom of the world has become the kingdom of our Lord”, and in the second line the dead are judged as in Revelation 20:11–15. In this context, “hearts of men” suggests Revelation 2:23 “I am he who searches hearts and minds, and I will repay each of you according to your deeds.”
Although “hearts of men” does not seem to have a single source, it has long been popular with Christians, going back at least to the Confessions of Augustine of Hippo:
Furtum certe punit lex tua, domine, et lex scripta in cordibus hominum, quam ne ipsa quidem delet iniquitas: quis enim fur aequo animo furem patitur?
Theft is punished by Thy law, O Lord, and the law written in the hearts of men, which iniquity itself effaces not. For what thief will abide a thief?
Augustine of Hippo (c. 400). Confessionum II.4. Translated by Edward Bouverie Pusey (1887). The Confessions of S. Augustine, p. 23. London: Walter Smith.
(This is a reference to Romans 2:15 “the requirements of the law are written on their hearts”.)