Adds a generate() method to the TestNode class in the test framework.
This method intercepts calls to generate, imports a dewterministic
private key to the node and then calls generatetoaddress to generate the
block to that address.
Note that repeated calls to importprivkey for the same private keys are
no-ops, so it's fine to call the generate() method many times.
This is a partial backport of Core PR14468 : https://github.com/bitcoin/bitcoin/pull/14468/commits/aab81720de237b258ed4e15f1b1831c11abf74f0
The code was slightly tweaked because we have some tests for which `self.rpc` is `None` because they've been created after PR14631 which remove the call to importprivkey
Depends on D5969