Maybe your HBA is having issues? or a Drive is Failing? have you done a memtest? you may need to do system wide tests, it can even be a PSU failing or a software Bug.
also TrueNAS is built with Docker they use it heavily something like 106 apps, Debian has good ZFS support, but you will end up doing a lot of unneeded work using Debian unless you keep it simple.
many people just buy junk like this https://www.amazon.com/Mikrotik-Router-Switch-CRS305-CRS305-1G-4S/dp/B08437RDM1 it’s cheaper in the long run.
You will need a good 10Gb nic, I have been using Intel nic’s if you use a Intrusion Prevention System that can eat away at the CPU, also more RAM helps like 8GB’s or more for IPS, I use 16GB’s for IPS + ZFS and a nice Switch can help a lot as it can do DNS and the works, more or less i use a firewall box to a Switch and use a Layer 3 Switch for routing, some can do 20+Gb’s routing.