Do I understand correctly that the permissions dialog popup is caused solely by SO_REUSEADDR? If that is the case, did you try to just remove setting this option without doing anything else, does anything break?
I am not fully sure now without more testing, but it is possible this SO_REUSEADDR was only needed to avoid test failures on Wine when closing the socket do not immediately make the port available for listen (unlike Windows). SO_REUSEADDR has completely different semantics between winsock and BSD sockets. Since not so long ago the compatibility on this part has been improved in Wine, we now always set native SO_REUSEADDR on TCP sockets. And test expectedly doesn't break for me in Wine if I just remove SO_REUSEADDR. I didn't test it on Windows (only run on testbot) but I'd hope it will be fine there as well.