@scottishwildcat is correct. Most of /System is off-limits to changes so long as System Integrity Protection (SIP) is enabled.
You can temporarily disable SIP by rebooting into Recovery Mode (press and hold Command-R from the time the computer starts until you see the Apple logo), then opening Terminal from the Utilities menu and entering this command:
Reboot back into Recovery Mode and access the Terminal again. Enter your desired command, then enter this command to re-enable SIP:
Reboot one more time into macOS as normal and AirPlayUIAgent should have the specified permissions. Note you'll likely need to redo this each time you upgrade macOS.