If you load a file entity through entity manager $file->status
is of "FieldItemList" type.
The condition in "_editor_record_file_usage" function is :
if ($file->status !== FILE_STATUS_PERMANENT)
As type of FILE_STATUS_PERMANENT
is "int" we have a wrong assumption that file is not permanent.
Field values should be accessed as $entity->field_name->value
Solution :
Change condition to
if (!$file->isPermanent())