A generic answer to your question is that the software was signed by whoever compiled or distributed the software, which can include your own machine. Your own key is in your trust store or your app distribution method put their key in your trust store. Both macOS and Windows will treat software compiled on the same system it is run on as blessed to run without strict signing checks.
On macOS, ad-hoc certificates can be used, but the OS will treat those binaries as if they're radioactive. If you compiled code on macOS, the system will treat that software specially on that specific system and allow you to run it[1]. On Windows, certificates can be added to trust stores. Chocolately, for example, has their own signing certificate for all of the compiled open source software they have in their repositories, so Windows allows their software to run.
The biggest issue is what comes with software distribution itself, where your code isn't blessed by default by the system it was compiled on, or doesn't have signing certificates in the users' trust stores, and Gatekeeper and Windows Defender go out of their way to stop your users from running software with signing certificates they don't like.
Every browser I know uses the Mark of the Web to tell Windows that a file came from the internet. You'll have to store the file on a FAT32/exFAT drive to get rid of it. If a file comes from the internet, smart screen kicks in.
When a file is unsigned, smartscreen essentially prevents you from running the file. You can work around it, but I had to look up a tutorial myself.
If the file is signed, metadata will be extracted and submitted to Microsoft. If that fails or the exact binary hasn't been run on a certain amount of computers, smart screen will show a big scary warning despite your $500 a year digital signing certificate. This is something developers just have to deal with every time they update their applications, but most people won't be the first x to download the executable and applications using auto updaters download updated in the background can the necessary flags to work around smartscreen.
The restrictions are there, but they're not there for (most) development environments and for most users of popular software.
This is true and annoying, but only with regular certificates. The more expensive EV certificates bypass this “well known” check.