I'm surprised that someone has not come up with a way to change the USB device enumeration in Windows to allow for customized or static device loading. I've found some very outdated apps for this that I could not get to run on Windows 11, but nothing current. I've tried making manual registry changes, but no luck getting that to work.
I'm sure you know that you can change the device order in MAME with a config file if the devices all have unique PIDs, but nothing like that for RetroArch that I have found.
I've had mixed luck with changing the port assignments in RetroArch. If you have other controllers to assign to Port 1 (for example) and that controller has an auto config, it seems to keep Aimtrac out of Port 1. For example, if I connect my Ultimarc 360 joysticks, I can assign those to the first two ports and the aimtraks to the second two ports and Retroarch keeps them in place. (Although I did have some issues with the auto configs getting confused between the two devices where the autoconfig for the 360 somehow got saved with the PID Aimtrak - but it worked after I got that sorted out. (The 360s were sometimes behaving erratically, which is why I 've been experimenting with other controller options.)
I've tried removing/uninstalling devices in device manager to get them to re-enumerate, but no luck with that either. Windows remembers the order based on when the device was first plugged in. The only way I've found to change that is to reinstall Windows and plug the devices in, one at a time, in the order you want them to be recognized. But in my case, if I don't have another device that Retroarch sees as a controller, it will still assign the Aimtracs to the first ports even if I set Port 1 to "none."
All that said, since your tanksticks are legit controllers recognized by RetroArch, you should be able to assign them to port 1 and port 2, save the controller profile (should get stored in one of the autoconfig subfolders like "dinput.") You can set the aimtracs to Ports 3 and 4 and save their config files as well. (make sure that the PIDs in the saved config files are correct). Turn on the setting that tells Retroarch to look for a controller config file (sorry not in front of my arcade machine at the moment to be more specific). This may or may not solve your problem, but if not, there is more to do. Load a game and go into the menu and go to the input config. If the controls aren't already mapped correctly based on what you just did, change them and save the remap config for that core/platform/game (whatever makes the most sense in your situation). Now, when you next load that game, you should see messages pop up in the lower left corner of the screen that the devices are being loaded and then remapped based on the config you saved. Now, when you check the inputs for that game, they should be correct. If you save the remap for the core, it will be the default for all machines emulated by that core. If you saved the remap for the directory, it will apply to all roms in that folder. (you get the idea).
Obviously, that's a workaround to having the devices load in the desired order to begin with, but see if it does the trick. The only other option that I can think of would be to reinstall Windows and then try connecting your controllers first and then your guns. In theory, that should enumerate the controllers first in the Windows device enumeration order. Will that for sure fix the order in RetroArch? I haven't tested that yet. Good luck!