I have three recessed lights connected in series inside of a new bathroom but would like to add a 4th above the shower stall for some extra lighting. Is it ok to run from the currently last light on this circuit into a switch that would then control the new light or is that illegal by code? I understand that the light will only work if the 1st switch is on, which won't be an issue since it will be turned on whenever the room is in use.
The switching should be OK, as far as I know, because you are adding a light that isn't absolutely required.
However, there is a big difference between the existing lights and the new lights. Ordinary bathroom lights (and fans) do not require GFCI protection. The exception is lighting above a tub or shower. There are, I believe, some special fixtures available that would not require GFCI, but normal fixtures do. Since you can't have the GFCI itself in the ceiling (and you wouldn't want to anyway - it would get hit by steam from the shower!), you need to protect the entire lighting circuit, either at the original switch or at the breaker. The problem is that means if there is a GFCI trip then you are in the dark. But not just in the dark, in the dark while in the shower. Not a good thing.