I have found a solution to my problem, or is it a cause?
As I mentioned earlier I am using an Adafruit PN532 breakout board. I was connecting this to a FTDI USB-to-TTL converter.
I dumped the FTDI converter and tried a Prolific PL2303 USB-to-RS232 converter with a separate RS232-to-TTL level converter, and all the problems disappeared, despite the messy setup.
The new setup works perfectly every single time. No failures, no errors. Finally!
Unfortunately the solution is a very long way from satisfactory in general. The FTDI chips allow direct conversion from USB to TTL serial levels, whereas the PL2303 requires a second, separate level converter to talk to the Adafruit breakout board.
But at least someone who knows more than me might know where to look to attempt to solve this problem. I might try changing the FTDI driver (if I can figure out how) and see if that makes any difference.