Dynamically define blocks in Drupal 8 with derivatives

During the Drupal 8 port of my relatively new Mefibs module I realized that block creation in code got somewhat more complex than it used to be in Drupal 7 and earlier. It took me quite a while to figure out how this works, especially because there is not a lot of documentation for Drupal 8 yet. So I had to dig my way through core to see how it's done there and finally I got around it. The following is a comparison between how we used to do this in Drupal 7 and how it's done in Drupal 8.

Use field markup for any value anywhere.

Sometimes I just want to display specific pieces of information in, say, a node view. For styling reasons it is often preferable to have the same kind of basic wrapper markup as for fields. This would be particularly useful for pseudo fields that can be declared using hook_extra_fields. Those pseudo fields act almost like real fields in the Fields UI, meaning I can position them just like real fields, put them into groups, etc.