Refactor refactored token bucket API to be more generic
The #25766 (moved) work makes us have a clean token bucket API. But that API isn't reusable yet. Let's fix it so we can use it for all the other places in our code that we want a token bucket.
The two main things to do here are:
- decouple "read bucket" from "write bucket".
- decouple "parameters" from "bucket value".
- make time generic.