Without digging into this, my recollection is that Fuji doesn't write out the standard Exif serial number tag like most manufacturers (Sony is another one). This Exif field wasn't part of the original Exif spec and so manufacturers have had to put this into their proprietary maker note. When Exif 2.1 was released and this SerialNumber field officially defined, most manufacturers instead put their serial number in this standard place, but not all.
Instead, for some makes like Fuji and Sony, we instead find a "internal serial number" inside their maker note. This has nothing to do with the actual serial number on the camera body - it is some bizarre number that at least remains constant for all photos taken by that camera (and therefore serves as a surrogate serial number).
Are you sure that your code replacement file doesn't already have these long internal serial numbers? I don't think this changed in PM 5 vs PM 6 (this part of the code should have been consistent). From your screenshot in the caption it looks like you are missing the closing delimiter "\".
If you don't like the long ugly internal serial number, try using a "slice" of the serial number like first N digits to generate your codes. For example:
{serial:10}
gives you first 10 digits, and:
{serial:-10}
gives you the last 10 digits. You will need to adjust accordingly to guarantee this is unique for all your various Fuji cameras.
HTH