This changes the logic of the pool into a true FIFO behavior: if there are already waiters, a thread will just wait and not preempt the waiters, unless it came there after resuming from a wait, in which case it should always get the connection.
Fixes #9111.