Fix: scheduler: correctly choose container vs inside resource for interleaving
Functionize finding an instance action for interleaving, to reduce
code duplication and improve readability.
For bundles, correctly choose the container or the containerized resource for
interleaving. Per the comment recently removed by f4660a16, the (correct)
intent for the 'first' instance in the ordering was to use the containerized
resource except for stops, but the code actually did the opposite.
Examples:
- start bundle A then start primitive B: we want B to wait until A's containerized resource is fully up, because it likely requires that service, not just the container itself
- stop bundle A then stop primitive B: we want A to be fully stopped before stopping B (B might be a file system with the container's image, for example)