Yes, the number of free-upkeep units is limited, depending on the type and size of the city.

Your suggestion has been proposed a couple of times for EB1 (a garrison script, it's usually called), but the problem is that there is no way to disband the units afterwards in R:TW. The scripting language simply doesn't have that option. EB2 will have better scripting commands, so maybe it will work there.

Welcome to the .Org, BTW.