A race condition was tested with a local reproducer re #32766 , but this should be part of the regular testing cadence.
The first Terminated signal is handled specially in #32756, which actually ends being put behind other stashed messages, delaying its processing.
To reproduce required at least 9 nodes, with 3 being terminated. But the main part to reproduce was probably having ongoing shard allocation when the nodes were being terminated, so that the terminated signals were received during state update.