Patch 2 fixes a race condition in theory. I haven't found it affecting any real-world applications.
These two bugs are caused by race conditions. I don't think adding tests could demonstrate them reliably.
This MR can probably fix the race condition mentioned at https://gitlab.winehq.org/wine/wine/-/merge_requests/4243 patch 3.