Yeah I see the poor practice issue here but not an actual code violation as long as we're talking about everything being on 1 circuit. It's still just a switch loop and the grounded conductor is already where you need it. Make sure you reidentify any white wire that's NOT used as a grounded conductor though.
Clearly not all the readers agree with my view on this. I'd be interested in what some who are inspectors have to say. George?