This is primarily motivated by The Finals which now won't tolerate wrong single step exception address in some specific cases. But probably it is also potentially beneficial for debuggers to have SetContextThread() to result in the correct first trap when setting the trap flag for remote thread while that thread is in a syscall (case 3 in the test).
The problem here is that 'iret' intentionally results in trap not happening at instruction it returns to, only on the one following that. It serves a good purpose for NtContinue (CONTEXT_INTEGER case in syscall dispatcher) but is wrong for syscall return with trap flag set on syscall, for NtSetContextThread setting trap flag and for return to instrumentation callback. The same is for 'popf': if it sets TF it will skip next instruction after popf. But 'popf' setting TF followed by 'iret' results in trap in happening at iret return address.
Patch "ntdll: Properly set context control registers from the other thread on wow64." is not exactly related to the purpose of this patchset but without that the added tests in wow64 mode fail in an unexpected way: trap flag is currently not set at all with NtSetContextThread for different thread.
Patch "ntdll: Set CONTEXT_CONTROL frame restore flag in sigsys_handler()." is partially related. Currently stepping through emulated syscall will result in the trap happening inside syscall dispatcher (cf. handle_syscall_trap() which sets CONTEXT_CONTROL to avoid that).