Question: do you have any leftover files in $PGDATA/pg_twophase ?
I'm wondering why the log contains no warning messages about stale
two-phase state files. It looks to me like the system should have
found the two-phase file still there upon restart, but the transaction
should have been marked already committed.
BTW, can you tell whether the failing transactions actually were committed
--- are their effects still visible in the database?
regards, tom lane