I understand it’s easy to make a port in that way. But some Linux ports are straight up worse than running through Wine, so it’s also important that the devs put some effort beyond just clicking a button.
Are Unity Linux builds actually via Wine and not native?
For understanding this, you have to understand how data structures in CS work.
Software code comprises of functions (micro code pieces) that ask system to give programs memory space (later free it up as well for other programs). For each OS (Windows, Linux and MacOS), the memory byte size of blocks and variables differ.
Games are designed with Windows as THE end user platform, and so are these system call functions. They are not made for Linux or MacOS. Wine allows to emulate/translate Windows system calls and Windows DLL and other files, and so programs run under Wine/Proton becomes a superior option to native Linux ports.
Wouldn’t the compiler take care of this?
If the functions used for memory calling/allocation are not hardcoded Windows system calls but relative ones, yes. There may be other examples of other calls too, otherwise a native Linux port being worse does not make sense.