Inconsistent "Switch user" action on Plasma/LightDM

The script of the previous post may solve the inconsistency explained at the beginning of the thread, but it has its drawbacks:

  1. Not a neat solution. In fact, I will wait a couple of day before considering the thread solved to see if somebody finds a problem I have missed

  2. LightDM Unlocking fails randomly (at least in my PC). Please see User gets logged out after unlocking! - LightDM/Plasma(X11)