You can specify the size of the tmpfs and keep it well below the size of RAM, which will greatly reduce the likelihood of a long-lived tmpfs from causing swapping.
But more importantly, don't write large files to /tmp/. Back in the day we gave /tmp/ its own partition just so those files didn't fill up the root mount. Write big files there and it would fill up. Plus, big files benefit more from a faster drive, and back in the day we used to put the root mount on a slow disk, and have a fast big data disk which is better for large files.
I think an option to prevent tmpfs from getting shifted to swap (or disk) at all would be great.
But more importantly, don't write large files to /tmp/. Back in the day we gave /tmp/ its own partition just so those files didn't fill up the root mount. Write big files there and it would fill up. Plus, big files benefit more from a faster drive, and back in the day we used to put the root mount on a slow disk, and have a fast big data disk which is better for large files.
I think an option to prevent tmpfs from getting shifted to swap (or disk) at all would be great.