Adding recessed lighting to room with ceiling fan/light already installed
That will work. Code depends on where you live, but I can't see anything wrong with making the junction away from the switch.

You might have issues doing all this in the fan box. It might be cleaner to put a small box in the ceiling and do your connections, then have a small run down to the fan. 

And be smart with placement of recessed lighting above a fan. You can get a strobing effect which is annoying (and gives some folks headaches).