A test that is added as part of #30455 uncovered this issue: The GuessVerificationProgress function is used during during descriptor import and relies on m_chain_tx_count. In #29370 an Assume was added expecting the m_chaint_tx_count to be set. However, as the test uncovered, GuessVerificationProgress is called with background sync blocks that have m_chaint_tx_count = 0 when they have not been downloaded and processed yet.
The simple fix is to remove the Assume. Users should not be thrown off by the Internal bug detected error. The behavior of importdescriptor is kept consistent with the behavior for blocks missing due to pruning.
The test by alfonsoromanz is cherry-picked here to show that the CI errors should be fixed by this change.
This PR also improves error messages returned by the importdescriptors and rescanblockchain RPCs. The error message now changes depending on the situation of the node, i.e. if pruning is happening or an assumutxo backgroundsync is active.