I do not want certain applications to get my actual serial number (the one you get with
ioreg -l | grep IOPlatformSerialNumber). How can the application get the serial number? Can I change the return request to a serial number I specified myself?
In general this is not easy to do (i.e. basically impossible for a non-technical user).
If you instead of this general case had a specific application in mind - that changes things considerably. With a specific application, you can use a system call tracer in order to discover which method the application uses to get to the serial number. Then you can override that particular method in order to return a faked serial number to the application. That could be done by modifying the application binary itself, by code injection through DYLD_INSERT_LIBRARIES or by a number of other methods.