The easiest way to limit the number of portal records is to remove the scroll bar. Then the number of portal rows that you specify in portal setup become a natural limit on the number that can be added.
And yes the count will not update until you commit records. But instead of using "allow creation..." and an add row to add new portal records you can use a button that performs a script to create a new record. This script can check the current number of related records and if the limit has been reached, it can refuse to create another. Conditional formatting can provide visual feedback by greying out the button's label when the limit has been reached.