[VPlan] Add getIndexFor(Predecessor|Successor) helpers (NFC).
Move code to get the index of a predecessor and successor to helpers in
VPBlockBase, to avoid duplication and enable future reuse.
Split off from https://github.com/llvm/llvm-project/pull/140409.