Why is it okay for a Lutron timer to have an 18 gauge ground wire?
This happens because UL has different rules for device parts
The timer's ground pigtail wire is the same as any other pigtail that is part of a device, and thus governed by the applicable UL standards instead of falling under NEC wire sizing rules.  You'll notice that the current-carrying pigtail wires on your dimmer are likely 18AWG or 16AWG, and this is true for devices such as light fixtures and fluorescent ballasts as well.  All of this uses the same logic in that UL-governed stuff can be tested for temperature rise explicitly at the device's rated nameplate load, and also can use different wire insulation temperature limits due to UL's adult supervision being involved.