I'm very sorry for your loss. It's miserable to lose a companion animal you've worked so hard to treat.
There's no way to tell without formal testing what exactly your boy was suffering from & what the ideal treatment to help his body fight it off would have been. It's not often we have access to hands on vet care. I can reassure you that our animals often carry everything from infection to parasites & are just fine with them. You didn't start any illness in this or your last
betta. However, with any of us, suboptimal conditions that lack or over provide something critical to our health can make a difference in health & survival. It's possible mineral deficiency restricted the tools betta needed to over come this particular organism. It's possible it played little to no role.
We do know general acceptable
water parameters & your testing will help you meet them. Can't guarantee that no health issues would crop up even with every single thing ideal but water quality within general guidelines would get you closer to those ideal conditions.
I'm so sorry. You've worked very hard.