[backport#15931 5/9] Refactor some importprunedfunds checks with guard clause
[backport#15931 5/9] Refactor some importprunedfunds checks with guard clause

Summary:
Credit to jkczyz

---

https://github.com/bitcoin/bitcoin/pull/15931/commits/769ff05e48fb53d4b62c59060424a0fea71d0aab

Depends on D7509

Partial backport of Core [[https://github.com/bitcoin/bitcoin/pull/15931 | PR15931]]

Test Plan:
  ninja check check-functional

Reviewers: #bitcoin_abc, Fabien

Reviewed By: #bitcoin_abc, Fabien

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

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