Atomicity of writes less than PIPE_BUF
applies only to pipes and FIFOs. For file writes, POSIX says:
This volume of POSIX.1-2008 does not specify behavior of concurrent
writes to a file from multiple processes. Applications should use some
form of concurrency control.
…which means that you’re on your own – different UNIX-likes will give different guarantees.