I believe we used the getFirmwareVersion() function on the TalonSRX to tell if a device was present. I think it returned zero if the device wasn’t connected. This was in 2017, though, so I think there have been some significant changes since then. I’m sure there are a few functions you could find for most devices that depend on the presence of a device (getTemperature() would probably work as well for the talons).
It may be a bit risky, but if you want to try and ensure you have a chance to fix the issue pre-match, you can purposefully crash your code. I wasn’t able to find the specific exception that we threw, but you might be able to find something that isn’t automatically handled by WPILib. Alternatively, you could potentially just call System.exit() (I suppose just exit() in C++) if the talons aren’t present, and I think the code will restart automatically until the issue is fixed. Another option might be to hang the code with a while loop until you find that all devices are connected. I don’t know enough about how WPILib works to know if this will actually cause a visible issue in the driver station, but it might work.
If somebody does try this, you should probably add in some way to bypass this easily, as it could leave a robot sitting entirely dead for a match when it doesn’t need to be. I’m not sure that I’d recommend this approach because of that.