I also code on the subway from time to time and this does occur to me. But there are locations in an NYC subway car you can sit that would make it very difficult for someone to grab your laptop and exit the train before the doors close. It's still a risk but it's not uncommon to see people with all kinds of valuable items (e.g. shopping bags from premium fashion stores) out in the open on the subway.
Crazy to think back to 2007 when iPhone users were advised to buy black earphones so the white ones wouldn't give them away as targets for theft. How far we've come/how commoditized our electronics have become.