File system code is tricky. Here's a similar (but less serious) bug in Linux, with btrfs[0], where ftruncate(2) would return an "impossible"[1] value. I presume the APFS bug's probably of a similar nature.
[0] https://github.com/torvalds/linux/commit/d50147381aa0c9725d6...
[1] https://pubs.opengroup.org/onlinepubs/9699919799/functions/f...