I think this is now common. I did the same thing to our replacement after I was laid off. My last 2 weeks with the company was in India doing a face to face training/handover.
Otherwise, hiring an H1B to replace an employee is illegal, but this is sort of a loophole.