Revert cb11e235: Allow classes in serialization. It may be unsafe, but classes are required. Maybe use Drupal\Component\Serialization\ObjectAwareSerializationInterface in future like in Drupal\Core\Cache\DatabaseBackend.php.
Closes #3462448