Value in my custom base field added to user entity isn't saved
In the end, I mofified my approach using https://www.drupal.org/project/one_time_password as an example. The difference is probably in the installation of the field definition - hook_install() works just fine.