Yes, macOS is a BSD - UNIX Certification and POSIX compliance is nice, but macOS does not behave the same way as Linux, which famously is not a Unix (it's even in the name), and POSIX compliance doesn't mean much today: even Windows 2000 and Windows Server 2003 were POSIX compliant with SFU.
From what I gather from people with far more experience than me: if you need a "Linux-compliant" environment you're better-off with WSL2 than macOS.
I'd argue you're better off with macOS + something like Parallels or, if you just need ubuntu, multipass. Introducing Windows to get a Linux-compliant environment is reaching around your back to scratch your elbow.
My use case for WSL is slightly different: I work with developers who run Windows and I'd like to be able to figure out workflows that will work on their systems. A coworker today was having issues with running a Docker container that apparently had something to do with how Docker was interacting with WSL, but I couldn't reproduce on my Linux or Mac systems.
MacPorts makes your Apple a Unix box in userspace and has most of the apps and frameworks and languages.
WSL2 is just running a Linux in a VM. You can do that with VirtualBox and other hypervisors. You can also spin up a Kubernetes runtime that supports Apple's Hypervisor Framework.
Ah true, some SW is built for specific Linux distros (on one side, it's hard to build an "universal binary" but on the other side, I've seen very ugly software installs)
From what I gather from people with far more experience than me: if you need a "Linux-compliant" environment you're better-off with WSL2 than macOS.