Can I update the TOTALTRACKS tag to find the max within a set where the album is the same

That was the intended behavior:

It's usually a good idea to link to the source of things that you copy and try to adjust for your use case.