How can I programmatically place blocks? I'm migrating a Drupal 7 site to Drupal 8.

The old site uses $ drush block_configure (available in Drush extras) to put blocks in regions while deploying, as well as $ drush block-disable to remove unwanted blocks. Unfortunately, Drush extras is no longer available for Drush 8, which seems to be the first version supporting Drupal 8.

The site will be deployed multiple times by multiple people, so adjusting region settings manually in admin view is not a solution. Everything needs to be done in an Ansible playbook so it can be passed on easily.

It seems that configuration management can be used to move blocks, but this would require all the environments to have up-to-date copies of a master database. While this is not impossible, it does feel like a hassle and a possible security risk. The developers don't really need to have all production data in their dev environments, and I wouldn't want to put production data on servers using developmental (and possibly vulnerable) code.

Twig Tweak seems to have an option to render a block anywhere regardless of regions. However, if I hardcode all blocks on templates, admins can no longer use admin block management.

Would it be possible to write a custom module and use block alter functions to set regions on blocks created by core modules? Are there any examples of this?

Are there more ways I'm not aware of? What is the best practice?
I was able to accomplish what I wanted using theme config, as described in How to assign blocks to particular regions on theme install? . This solution works for me, because my site will only ever use one (custom) theme, and I don't mind configuring all blocks this way.

I created a config file (this one is for a language switcher, provided by language module) and put it in MYTHEME/config/install/block.block.MYTHEME_BLOCKNAME.yml. It's just what you would export from configuration management, without uuid.

langcode: en
status: true
dependencies:
  module:
    - language
  theme:
    - MYTHEME
id: MYTHEME_BLOCKNAME
theme: MYTHEME
region: header
weight: -6
provider: null
plugin: 'language_block:language_interface'
settings:
  id: 'language_block:language_interface'
  label: 'Language switcher'
  provider: language
  label_display: '0'
visibility: {  }