[backport#17237 2/2] wallet: LearnRelatedScripts only if KeepDestination
[backport#17237 2/2] wallet: LearnRelatedScripts only if KeepDestination

Summary:
https://github.com/bitcoin/bitcoin/pull/17237/commits/3958295bc8a3787b66b0269190218a3764088f79

Depends on D7689

Concludes backport of Core [[https://github.com/bitcoin/bitcoin/pull/17237 | PR17237]]

Test Plan:
  ninja check check-functional

Reviewers: #bitcoin_abc, deadalnix, jasonbcox

Reviewed By: #bitcoin_abc, deadalnix, jasonbcox

Subscribers: deadalnix

Differential Revision: https://reviews.bitcoinabc.org/D7690

Bitcoin-ABC/bitcoin-abc,Bitcoin-ABC/bitcoin-abc,Bitcoin-ABC/bitcoin-abc,Bitcoin-ABC/bitcoin-abc,Bitcoin-ABC/bitcoin-abc,Bitcoin-ABC/bitcoin-abc,Bitcoin-ABC/bitcoin-abc,Bitcoin-ABC/bitcoin-abc,Bitcoin-ABC/bitcoin-abc,Bitcoin-ABC/bitcoin-abc,Bitcoin-ABC/bitcoin-abc,Bitcoin-ABC/bitcoin-abc,Bitcoin-ABC/bitcoin-abc