=con #15440 Add invariant checks to ClusterSharding state

* I suspect that the issue #15440 happens because of replay of events
  in wrong order (ShardHomeAllocated received before ShardRegionRegistered)
  by the hbase journal
* This does not fix that issue, but the additional invariant checks and
  debug statements  would perhaps make it easier for us to diagnose such
  issues
* These changes also ensures that the allocation strategy does not return
  the wrong thing.
* It also tightens a possible error if a region is terminated while a
  rebalance is in progress

(cherry picked from commit d07b9db4958236d580b8bfb8f92461969ff88cbc)
=per #15472 Flush instead of unstash when PersistentActor restarts

* When using the Processor batching buffer for persistAsync and defer
  the events were unstashed by Processor.aroundPreRestart and
  thereby were received as commands after restart
* Instead we must flush this buffer when using PersistentActor

(cherry picked from commit 627ce2fc85739e221524ec48725362ef7c0566ea)
Merge pull request #15476 from akka/wip-15472-15440-picks-master-patriknw

#15472 #15440 picks to master (for validation)