TinyMCE custom plugin breaking in 5.1.2

it seems dubious, the issue is closed, the fix is not explicited but from the post dates it could be this release, probably
' bug where various api calls would be throwing exceptions if they where invoked on a removed editor instance.'
The Tinymce version for 5.1.1 is 4.7.6 so this particular bug should be fixed.

Currently my take on this problem is here.