x265: Fix a deadlock when failing to create the x265enc.

The GST_ELEMENT_ERROR will call the gst_object_get_path_string and
use gst_object_get_parent to get the full object path name, which
needs to lock the object. But we are already in a locked context and
so this will cause a deadlock, the pipeline can not exit normally.

Part-of: <gstreamer/gst-plugins-bad!2460>
29 jobs for !2460 with backport-mr-2451-into-1.18-x265_deadlock in 28 minutes and 26 seconds (queued for 6 seconds)
merge request