How work BigPipe cache around block views?
I don't know why the second block is cached by big-pipe and not the
  first block.


This depends on the auto placeholder conditions defined in services.yml and the cache metadata of the block:

auto_placeholder_conditions:
  # Max-age at or below which caching is not considered worthwhile.
  #
  # Disable by setting to -1.
  #
  # @default 0
  max-age: 0
  # Cache contexts with a high cardinality.
  #
  # Disable by setting to [].
  #
  # @default ['session', 'user']
  contexts: ['session', 'user']
  # Tags with a high invalidation frequency.
  #
  # Disable by setting to [].
  #
  # @default []
  tags: []


As mentioned in the comments, when the module BigPipe is enabled you need to use Drupal.behaviors for your javascript, see:

https://www.drupal.org/docs/8/api/javascript-api/javascript-api-overview