Fix index out of bounds when removing deferred containers

This makes the commit 793442c general to handle the removal from
all level since the hierarchy won't always keep the same shape.

Also rename to handleCompleteDeferredRemoval since it is not a
pure function for checking.

Fixes: 159865315
Test: atest WindowContainerTests#testHandleCompleteDeferredRemoval

Change-Id: I34e02652fb765c1cf78cbd3e86a07e592f02e7df
Merged-In: I34e02652fb765c1cf78cbd3e86a07e592f02e7df
6 files changed