How do I install Flysystem and Flysystem S3?
That documentation you referenced is outdated and wrong. You should read the official documentation on https://www.drupal.org/node/2404989.

The easiest way to do this is to install the drupal modules with composer, as documented on https://www.drupal.org/node/2718229. Once you've configured the drupal.org repository, installing a module is as simple as composer require drupal/flysystem. That will download that module, including alll dependencies that it needs for you.

You can manage your whole installation, including core, with composer if you use composer create-project drupal-composer/drupal-project:8.x-dev. You can also add contrib modules if you installed drupal core by hand, but when updating core, you need to be careful to not lose your composer.json changes and run composer update again.