Not as pithy, but this is (probably) the original source: https://www.accesstoinsight.org/tipitaka/sn/sn36/sn36.006.th...
It's often phrased in terms of the "first arrow" (pain) and the "second arrow" (suffering in reaction to the pain): the second arrow is optional and self-inflicted.
Apparently the earliest known source is the book The Promise of a New Day (1983) by Karen Casey.
https://fakebuddhaquotes.com/pain-is-inevitable-suffering-is...
This is the sort of thing one can email to the Quote Investigator. Maybe I will.