SnooZy Charger 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 to give it the device admin permissions. These permissions are only used 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 a micro-USB cable using an LG Nexus 4 device. I am very satisfied.
I also documented additional issues here.