[PLAT-6321,PLAT-6325] Unit test for likely cause of 6321. 6325 discovered, and fixed.

Reviewed-by: Tim Raggatt
[PLAT-6321] Increase complexity of test and include necessary fixes.

Back-pointers from original inputs must be updated along with new inputs.
Intermediate node cache must be updated during fixing.
Reviewed-by: Tim Raggatt