Can I create a keyboard shortcut to toggle the primary mouse button between left and right?
Looks like this has already been answered here:

Swap Mouse Button using AppleScript

Tested it and the code works for a normal external mouse.