SnooZy Charger (also in the Play Store) takes care of this. The free app (as in beer and speech) that lets you manage behavior during charger connection and disconnection.
It requires no permissions, but does require you giving it device admin permissions. These permissions are only used for to control device locking, as verifiable in its source-code. From quickly going through the app’s source-code, it looks totally harmless and benign.
If the app does not behave as you want, make sure to go through the Settings. For example, “Turn off screen only when locked” is enabled by default. This means that the app will not kick into effect if you have an on/off-button-press-lock delay or other related settings.
It works perfectly for my on a wireless charging pad and with micro-USB cable using a LG Nexus 4 device. I am very satisfied.
Update: I documented additional issues here.