[cli] Fix regression loading plugins

* Fix regression when loading a plugin already loaded (see change 12996)
* Added unit test

Change-Id: I1b5bc519597f611274a7fe3a44f969584dc22750
Merge remote-tracking branch 'upstream/master'