Limiting current on demand
In USB, there's two current limits to consider:


Downstream-facing limit
Upstream draw


The downstream limit varies depending on whether you are a host or hub, and whether you're a battery charger or not.


Bus-powered hub downstream: 100mA
Self-powered or host downstream, USB2: 500mA
Self-powered or host downstream, USB3: 900mA
Battery charger, USB 2 or 3: up to 2.1 or 2.4A


When you attach a device, it is supposed to sense, then obey the limits set by the upstream port. For a device that has a USB endpoint, this is done as a protocol. For battery charging, the endpoint looks at the D+/D- voltage to determine how much current it is allowed to draw.

More about that sensing here: https://www.maximintegrated.com/en/design/technical-documents/tutorials/4/4803.html

The takeaway is, unless you're a hub, you don't need to limit the downstream current other than what USB specifies. It is up to the device to self-limit its current.