From max in the comments
You seem to be somewhat confused about how this is supposted to work. Your YAML file just contains a reference to the class and doesn't actually serialize the class itself. You still need to actually load the code containing the class before you parse the YAML. Either through require or by autoloading with Zeitwerk.