Because there are a lot of features beyond just streaming a screen capture, it supports many versions of Android, and it is a polished utility.
The actually screen recording part is simple since you are just using existing Android APIs to have hook up the diplay server to a media encoder and the media encoder to the network.
That is reasonablish as video APIs go. But it's quite a small part of all scrcpy has to do to mirror the screen over the network.
Most of that code would be covered with something like "gst-launch pipewiresrc ! encodebin" and the whole mirroring with adding a few elements.
Well, in theory at least; gstreamer has the habbit of getting quite fiddly oftentimes. But I don't see any fundamental problems why this too couldn't work with simple composable tools.