I have looked into using udev. I found out that the Arduinos with FTDI interface do have unique serial number whereas the cheaper clones with CH341 interface do not have serial number so I have ordered nanos with FTDI chip to continue my experiment.
I have also managed to get the gateway to send out sensor's data with a gateway id other than 0 by making one line change in core/MySensorCore.cpp:
if (message.destination == _nc.nodeId) -> if (message.destination == 0)
Assuming that this hack does not create other problems, I can now have multiple gateways with different ids. But I am facing a new hurdle: mysensors plugin for pimatic (controller software) is designed to support only 1 gateway! I can probably make it work by creating individual plugin for individual USB port but I am not so sure that creating a system with unsupported hacks is such a good idea. So I will pursue another approach of creating a controller with a bunch of sensor nodes hanging off USB ports.