Removing $if($gt(%totaldiscs%,1),%discnumber%-,) didn't help. In fact, it introduced a new problem. Previously, albums with multiple disks were named disc number - track number. So for the 5th track of the second disk, picard would name it 2-5... this is what I wanted. By removing $if($gt(%totaldiscs%,1),%discnumber%-,), the same file is now named 5... without the disc number. And picard is still creating two folders, one with all the tracks from disc 1 and another with all the tracks from disc 2.
I copied it from somewhere else and messed around with it until it gave me the results I wanted. I don't actually know the syntax.