prune old inactive branches as first step of staging a train
This will keep the cleanup of old branches from being affected by failures during the rest of the presync process.
The way branches are selected for pruning has also changed. Now we keep active branches as before and only the most recent inactive branch, regardless of age
Bug: T355117