I think this is one of those cases where kafka only finds your class if it's AOT compiled. So you might want to have a separate namespace to define a class that implements the DeserializationExceptionHandler interface. Then you can just add the property to the streams config.
StreamsConfig/DEFAULT_DESERIALIZATION_EXCEPTION_HANDLER_CLASS_CONFIG
"com.you.MyCustomDeserializationExceptionHandler"