There is no settings for that, it is just using iOS system palm rejection.
I recommend using "Pencil Only" mode if your palm adds accidental strokes.
To turn it on tap "pencil-finger" icon in the top toolbar.
You can then turn on/off 2-finger undo in Pencil Only mode (Preferences > Apple Pencil > Allow Finger Undo Gesture).