As many others post, the use of #14 for switch legs on a 20 amp circuit is a clear violation of the NEC which requires at least #12 in all common circumstances.
It would in practice be safe, but still a violation.
The current is limited by the lamps used, hardly likely to exceed 15 amps on one fixture or small group of fixtures, therefore no risk of overload in normal use.
In the event of a short circuit, then #14 will easily handle the short term current required to open a 20 amp circuit breaker.
After all, 15 amp outlets are often wired on 20 amp circuits. No one worries about #14 or smaller appliance cords or extension cords on a 20 amp breaker.
Although Code treats fixed wiring and appliance cords differently, the laws of physics are the same.
#14 appliance cord on 20 amp breaker, permitted and safe in practice.
#14 romex on a switch leg from a 20 amp breaker, just as safe in practice but is a violation.