It's a safety measure. The driver exiting the running vehicle is generally an unsafe condition. But I agree, shutting the car down does seem a bit extreme. Perhaps there is a "presence" sensor that isn't perfectly consistent.
For grins, try opening the door to exit the vehicle with it in gear. The transmission will automatically go into Park, even if the car is rolling forward slightly. Ok, be careful when trying this.