It depends on the manufacturer.
As stated by @GdD this is an explicit safety provision for cases of crashes. Note emphasis.
It is worth to note that modern Volkswagen cars (I can confirm Golf and Passat >=2014) implement SAFE lock, which blocks the handle when the anti-theft is armed. Despite the name, this one is a security (emphasis again) provision that makes it harder for a thief to open a parked car from the outside after breaking the glass.
The two locks engage in different lock modes. When the car is moving, doors are normally locked from the outside but it's still possible to break the glass and open the handle: this is especially true for rescue personnel when passengers are found incapacitated.
On the contrary, when the car is parked and antitheft system is armed, you don't see any possible urgent need for anybody to crack open your car. You actually want nobody to crack it open with the handle when safely parked.
I was also both victim and witness of a very simple car stereo theft where the son of a £$%&/(/%$£"() broke the glass and released the lock of all the cars with ease.