The wallet does not store any information about multipath descriptors. When a multipath descriptor is imported, it is first expanded, then the expansion descriptors are imported into the wallet.
This PR adds a field to WalletDescriptor which stores the IDs of the ScriptPubKeyMans of the descriptors that are part of the expansion, in the order that they are expanded. This allows us to use ReconstructMultipath to produce the multipath descriptor when necessary.
This is useful for working with hardware wallets that require policy registration, particularly those that require resending the descriptor that was registered.
listdescriptors is updated to include a multipath_descriptor field which contains the multipath descriptor for each individual descriptor if it originally came from a multipath descriptor.
Lastly, the automatically generated descriptors are now produced and stored as multipath descriptors, so listdescriptors will provide a multipath_descriptor for everything that the wallet automatically generates.
Note that the IDs stored in the wallet are ScriptPubKeyMan IDs, which we cannot compute from a descriptor as we assume to be opaque blobs since #35445.