Hey, this is probably a triggers problem, but I am hoping this can be done in Data. If not please let me know the trigger solution.
For simplicity sake, I have a Barracks "spawner" unit. It has a passive ability that spawns a Marine every 10 seconds. This ability is auto cast. I want each barracks to have a cap for the max amount of units it can have alive at one time. Let's say 10 Marines is the cap. If 10 Marines from that Barracks are alive, it won't make any more until one dies. (Each Barracks has its own cap, rather than all Barracks sharing the same cap) I believe the arcade game Zerg Hex uses something like this.
I would try looking at a Hatchery and their Larva spawning. They have some stuff that limits the number of total Larva the hatchery spawns. I believe this is both on the behavior as well as a requirement and/or validator.
Ended up doing a charge based system where spawn unit charges are not automatically restored over time. Spawn unit ability applies a buff behavior to the unit that has a second effect triggering on death response, restoring a charge to the spawner.