Yes complete everyone's loyalty mission (and all DLC missions if you want those wont matter much unless you want a different beginning for ME3) before getting legion, after getting him talk to him immediately to get his loyalty quest. Go to that quest right after talking to him, after you are done your crew will be abducted and you can save them. And make sure to have your ship fully upgraded or your team will die and that you choose the right people for the jobs at the end.

Correct. Just talk to him immediately, no matter what EDI says about the IFF beeing ready. I even did Tali's and Legion LM after the Derelict Reaper and before the Normandy abductions. But it is vital that you talk to Legion asap to activate this mission buffer. Ohterwise the Joker-ducts-tour will occur.

It does indeed depend on the number of active missions left for you, including dlc and assignments. Only those with a debriefing screen do count. Overlord, LotSB, the Citadel LM's, the Illium LM's and Tuchanka LM's do count as 1 Mission here, as you don't leave the planet after finishing one on the missions.

But even if you did any other mission and assignment up to this point, Legions LM is always a go, if you talk to him right after activating it, thus preventing an instant abduction sequence.

Almost every time, I save Tali's loyalty mission for last, because you have 2 missions you can complete after getting the Reaper IFF. Get Legion, and you can do his AND Tali's loyalty mission and still rescue the crew. Only reason I'm specifying Tali is that there's some pretty cool dialogue you get if you try to bring Legion onto the Quarian ships.