What about something like https://gitlab.winehq.org/rbernon/wine/-/commits/mr/7623? I've split the changes to make individual fixups more obvious and made other tweaks.
If you think it's okay please update the MR with that branch, I would approve then.