I've come to think that perhaps the best way to explain this is to get people to think about their cordless drill or battery leaf blower or some other appliance that uses lithium batteries (or any battery, really). You plop that battery into a charger when you are not using it. The battery has temperature sensors built into it (that's why there are so many pins) and so the charger is informed about the battery temperature. The charger also has circuits which measure the voltages of the individual cells (another reason there are more than 2 pins) and so it knows about the state of charge of the battery as well. It has a microprocessor in it that knows how much charge it can, based on temperature and voltage readings, send to the battery to charge it as fast as possible without damaging it. It commands an internal power supply to send that much current to the battery.
It's exactly the same in your car. The BMS knows the charge status of the battery and it knows it's temperature. From that it can calculate safe charging current. It does this and, if you take your foot off the pedal, commands the power supply, which in the car is the motor acting as a generator, to supply that much current and no more. If battery temperature is low or the battery is nearly charged it will tell the generator to back off. Recognize that there is another factor here and that is how rapidly you want to slow down. If you take your foot off the pedal you clearly want to slow as much as possible and the limit will be what the battery can safely accept. If you only back off a little and the current command will be limited by the desired braking torque as well.
The idea that regen is limited when near full charge "because there is no place for the energy to go" seems to be popular. But it is incorrect. The energy does have someplace to go and that is the battery. The problem is that when the battery is cold or nearly fully charged sending energy to it will damage it. Thus the controller does not send energy under those circumstances.