The example above is close enough but still not correct. The idea is that you have to come up with your own id of the block instance (in my case devel_execute_php_1112 (maybe because I tried to make it work 1112 times, it will remain mystery)) and then the actual block id (the one that is declared for the custom blocks in the annotation) and the theme. Then just set the region and you are good to go. Created an instance of a block under the desired region.
$blockEntityManager = \Drupal::service('entity.manager')->getStorage('block');
$block = $blockEntityManager->create(
array(
'id'=> 'devel_execute_php_1112',
'plugin' => 'devel_execute_php',
'theme' => 'seven'
)
);
$block->setRegion('content');
$block->save();
edit1:
I actually checked later the comment above - and it is right. It is just not clear that the id is something that you have to come up with.
As a redemption for my lame comment I will post a solution on how to create a block instance of a custom block entity:
$blockEntityManager = \Drupal::service('entity.manager')->getStorage('block');
$block = $blockEntityManager->create(
array(
'id'=> 'ggggggggsssssss',
'plugin' => 'block_content:79d53b4e-9e60-4f97-befc-101da919bb7a',
'theme' => 'visitb_he_theme'
)
);
$block->setRegion('content');
basically the same but for a plugin you write block_content:uuid_of_custom_block_entity_instance