Create unittests for circuit timeout tracking

We don't have any unittests for tracking circuit timeouts, and hence it's hard to catch bugs like #26121 (moved).