People reprogram the 16U2 for HID interfaces & stuff, yes?
Turning on a PWM output wouldn't seem that difficult.
Maybe add to this file that is included in the IDE, do the makefile stuff, reload it via the 16U2 ICSP header.
That is my point, when you get to using makefile and compilation, linking, etc, all outside the standard IDE you are definitely talking programmer guru territory. I certainly can't do it even after >5 years of arduino experience, and I suspect you don't have the needed knowledge and experience also? We both know it can be done, but would have little luck explaining to the OP how he can accomplish it?