fix: always ensure element before set to weakmap (#75012)
### What
Regression introduced in #74670, where the element somehow is invalid to
be observed by observer or be set as key in to WeakMap. The possible
cause is `mountInstance` is calling with `null`.
```
TypeError: Failed to execute 'observe' on 'IntersectionObserver': parameter 1 is not of type 'Element'.
```
```
TypeError: Invalid value used as weak map key
at WeakMap.set (<anonymous>)
```
The root cause is the `useMergedRef` could return `null` in callback, we
need to filter them out before passing to `mountLinkInstance` or
`unmountLinkInstance`