The protocol Apple uses under the hood is AWDL (Apple Wireless Direct Link), which is a proprietary peer-to-peer layer that runs alongside your existing WiFi connection without dropping it. It uses a time-sliced channel-hopping mechanism so the radio can serve both infrastructure WiFi and the direct peer link simultaneously.
That’s the part that’s hard to replicate. LocalSend and most alternatives need an existing shared network because they’re just TCP/IP, they have no way to negotiate a direct radio link without OS-level support. Even Android’s QuickShare, which does peer-to-peer via WiFi Direct, drops your existing WiFi connection on older devices because the radio can only be associated with one BSS at a time.
The EU interoperability mandate lxgr mentions would theoretically require Apple to expose this, but AWDL interop would mean licensing or reverse-engineering some fairly deep radio scheduling logic, so I’d expect compliance via a different (probably slower) path.