bug: allow per-ID generation functions.

This helps with concurrent requests and mimics the scheme used for
per-ID pending callbacks.
refactor: reuse implementation of _getId