What is the maximum number of devices a single PCI bus can handle?
When using a physical PCI bus, this mapping scheme indeed limits the number of devices to 21. This is not a problem in practice because that many devices would be too large a load for the bus anyway (see jonk's comment).

This limit does not necessarily apply when you do not have a physical PCI bus. For example, PCI Express connections are point-to-point, so any PCIe bridge/switch that supports more than one downstream port actually has a bridge that connects the upstream port to its internal bus, and, for each downstream port, one bridge to connect the internal bus to the downstream bus. The internal bus is completely virtual (no physical IDSEL pins required) and could use up to 32 devices.