I have a menu which has a block provided by the system automatically. This menu has links that come from a module which defines the menu(config). This menu block can be seen(ie. the block is visible) but it shouldn't be possible to attach another instance of this menu nor put links into it via UI. I do not want the admin so see this menu block in the list of available blocks on the block library page.
So far I have been able to tweak things so that some specific menus are not available for user to put links into or even see them in the menu listing(I have custom list builder for this + some form alterations in place). But when it comes to blocks the issue is that on some places Drupal checks plugin definitions(which are cached so I cannot distinguish if the user is on the "manage blocks" page or somewhere else or if the user has specific permissions and such) and in other places it uses the block entities.
So my question is how can I hide a block from the block library but keep the block displayed when attached to a region? If I remove the plugin definition the bloc kwon' be displayed since the plugin will be non existing. This works in other cases that I have but not int this one.
I think this relates to https://www.drupal.org/node/1975064 but I need to fix this ASAP.