I'm not an LEO, but I'd say it depends... could your friend safely stop quick enough so they wouldnt be in the middle of the intersection? or were they already a few feet away from the intersection when it turned yellow?
To answer you question, yes it is legal. There are a few scenarios where it would be prudent to issue such a ticket. But more where the ticket was issued in relation to the driver's attitude after the warning stop.