Operating systems do not guarantee that writes reach disk in the same order in which they are made, unless O_DIRECT|O_SYNC is used or explicit calls to a flush function (such as fsync() on Unix-like systems or FlushFileBuffers() on Windows) are made and succeed. Therefore, it is possible that both the writes to the primary and backup partition tables can partially succeed, leaving the system with no valid partition table and therefore unbootable.
The solution is to add the needed flushing where necessary. User code cannot provide this flushing because no user code runs in the places where barriers are needed.