Thank you very much, that confirms what I suspected.
On windows, one can use the _SH_DENYRD flag when calling open and this locks the file so any other process using any available file opening method will be prevented access to it.
I was merely looking for a similar functionality on macOS.
I need to prevent any other process (using any open method that's not under my control) from accessing a file until I'm done with what I want to do with it. I guess my best option would be chmod then.