That usually happens if the L2/R2 are registered as axis,

Yes, that is the issue.

Try re-installing xpad from RetroPie-Setup and see if the mapping in EmulationStation works.

I did try that. Didn't fix the issue.