target_link_libraries: Fix static library private deps in other dirs
In !2370 (merged) we accidentally broke the logic that adds $<LINK_ONLY:...>
to private dependencies of static libraries in their INTERFACE_LINK_LIBRARIES
in the case that the dependency is added from outside the directory creating the library. The check for a valid target name should apply to the original name specified by the caller and not the encoded cross-directory reference.
Fixes: #19197 (closed)