Not sure tbh but I still have a .txt file from 2007 in my MAME downloads folder that fixed the UP/DOWN issue which was changed to LEFT/RIGHT but the numbers are the same as what I see in your post. Perhaps you need to check all your config files to be sure the settings are correct.
ui_joy_up 1,1,1,1
ui_joy_down 1,1,1,2
ui_joy_left 1,1,2,1
ui_joy_right 1,1,2,2