Backport of gh-30615

Comment From: jhoeller

This has been separately addressed with a minimal change in the 5.3.x branch: the opaque check is in equals instead and the optimize flag is not considered for CallbackFilter equality at all anymore. This makes equals/hashCode internally consistent but is not as optimal as the advisor key arrangement in 6.0.10, neither in terms of performance nor in terms of memory leaks.