The topology coordinator schedules a priority takeover whenever its internal state indicates that the existing primary has a lower priority than the current node and the term of the remote node matches its own.
When an election is taking place (due to a node with a higher priority than the current) and the current primary is in the midst of stepping down, it will not update its own term due to
SERVER-21425. But the term in other nodes would have increased. The heartbeat responses from these secondaries would be sufficient to trigger a priority takeover.