I think the problem is you're referencing th first instance of the subform and so getting always the number of pages it spans.
Given your subform is named "customer" than the code xfa.layout.pageSpan(customer) really means xfa.layout.pageSpan(customer) which is the first instance. For repeated objects you'll need to address the desired instance. This can be done either direct or relative.
// Get the page span of the third instance of the object 'customer' under form1.page.
xfa.layout.pageSpan(form1.page.customer); // FormCalc
If the script is executed for an object which resides within the object to be addressed, you can use use a relative expression starting from the current object. It's much easier, since you don't have to deal with complex SOM expressions.
xfa.layout.pageSpan(this.parent); // Get the page span of a subform that surrounds this fields