It was largely my fault.
These things are often me overlooking some glitch in my code. I took part of your code and used an assembly function I already had.
I called the function from C after setting A, and obviously A was changed between.
But, the fact that it only returns Y as some unknown value that is not $0 and not $FF for controller present.
I don't know what that is.
The fact that it swaps the controllers. No clue.
The fact that it applied controller key presses to which ever player was created first? That really seems weird and doesn't seem like it should happen. But, that one isn't happening any more. the first two still are, but I can work around them.