How do I programmatically place a block?
To provide a plugin block you can build an array of settings and pass it off to \Drupal\block\Entity\Block::create() to create the Block object and save the instance.

For example if you wanted to add a Devel Execute PHP block to the Seven theme:

$values = array(
  // A unique ID for the block instance.
  'id' =&gt; 'devel_execute_php_1',
  // The plugin block id as defined in the class.
  'plugin' =&gt; 'devel_execute_php',
  // The machine name of the theme region.
  'region' =&gt; 'content',
  'settings' =&gt; array(
    'label' =&gt; 'Execute PHP',
  ),
  // The machine name of the theme.  
  'theme' =&gt; 'seven',
  'visibility' =&gt; array(),
  'weight' =&gt; 100,
);
$block = \Drupal\block\Entity\Block::create($values);
$block-&gt;save();