> How is this the OS's sole role?
Embedded Design.
A PWM driver (or a hardware timer) will handle the nanosecond-to-nanosecond wait states and counts, but the OS has to still setup the hardware timer to send the right PWM wave down to the system.
Besides, the OS should have some degree of custom fan controls for any modern computer, embedded or not. My PC can control all of my fans for example.
Sure, I think the OP knows this, but another (arguably much more common) way to do fan control is to have a secondary control system (be it a separate management processor, fan IC, management core on the same SoC, whatever) know about temperature curves/thresholds and have that IC handle sensor input to set the PWM.
This is the usual way things are done on x86 with ACPI, for example - unless the OS or some userland fan manager elects to take over via the OSPM fan objects, the fans control is delegated to the BIOS/platform firmware. If I boot an OS with no notion of a fan on a common x86 motherboard, it will still cool reasonably well (usually). Same deal for Macs with SMC - unless the OS tells the SMC explicitly to quit handling the fan, the SMC deals with all the thermals with no intervention.