Ah, no, that is running locally – the call to make-process is not using file handlers, and the purpose of setting that default directory was to ensure that it didn't.
That said, I retested with `(default-directory (expand-file-name "~"))` there, and performance is identical:
========== pass 1 ==========
write-with-temp-buffer: 5.8827s with 0 GCs taking 0.0000s: (5.882696 0 0.0)
write-with-two-calls: 2.4786s with 0 GCs taking 0.0000s: (2.478616 0 0.0)
write-with-one-call: 1.9073s with 0 GCs taking 0.0000s: (1.907256 0 0.0)
========== pass 2 ==========
write-with-temp-buffer: 5.6867s with 0 GCs taking 0.0000s: (5.686659 0 0.0)
write-with-two-calls: 2.2408s with 0 GCs taking 0.0000s: (2.240782 0 0.0)
write-with-one-call: 1.8802s with 0 GCs taking 0.0000s: (1.8801780000000001 0 0.0)
========== pass 3 ==========
write-with-temp-buffer: 5.7305s with 0 GCs taking 0.0000s: (5.730538999999999 0 0.0)
write-with-two-calls: 2.3394s with 0 GCs taking 0.0000s: (2.339416 0 0.0)
write-with-one-call: 1.9350s with 0 GCs taking 0.0000s: (1.9350479999999999 0 0.0)