Yet it is amazing that this deal works at all – however imperfectly. For it breaches countless generations of human social arrangements.
––Sapiens: A Brief History of Humankind, by Yuval Noah Harari, pg. 359-60
What grammatical function does "for" in the sentence have?
And I'm not sure what the last sentence is talking about also.