As @mitxela says, if you need to fault in a page which is needed for some critical OS function, which requires going through the VFS layer, and that requires paging in another page, which has been swapped out due to memory pressure ... There are many edge cases.
Swap on primary partitions also complicates dump and restore, although hardly anyone seems to know what backups are now.
See, the thing is that swapping or paging to a file does not use the VFS layer, except when activating or deactivating it. So swapfiles may not be materially different from swap partitions during operations.
And there are many things that complicate dump and restore. Dump and restore often need to account for what partitions were created, anyway, so don't swap partitions also complicate it?
This was 2021, and while this bug is fixed, maybe take Linus's advice. Rely on a partition for primary swap, and only add files if you need to. Don't put them on the root partition, preferably a second disk.
Normally dump skips swap partitions entirely, and doesn't know anything about partitioning. Swap will refuse to activate on a non-mkswap partition so there is reasonable protection when you're migrating.
One traditional reason to prefer a swap partition was that the filesystem driver might have to allocate memory. I think swap files bypass the filesystem driver, though - getting the block extents and then accessing the block device at those locations, instead of accessing the file.