NEW DELHI—As an aviator, Smit Machchhar had piloted through an in-flight birth, turbulent monsoon skies and a high-wire landing in Greece that stretched his skills to the limit. On Wednesday, the 38-year-old Indian pilot faced a midair incident of a completely different sort: a violent stabbing attack from within the cockpit. Captain Machchhar fought off his attacker while in charge of a FlyDubai Boeing 737 MAX 8 passenger jet to Tel Aviv, apparently managing to alert air-traffic control, open the cockpit door and allow passengers and crew to rescue the plane from a petrifying plunge. His heroism was hailed by…