Actually the backup on the Time Capsule is pretty safe.. regardless of the connection..
Recent ransomware attack used a weakness in ancient SMB protocol.. but that protocol is not used by the TC for backup.. it is still AFP even in the most recent MacOS.
And of course our Macs are pretty resistant to this kind of virus anyway.
But it is never a bad thing to have a secondary backup.. which you connect only when required.
Network backups do not stop ransomware on windows systems. So if they manage to get one into the Mac it is irrelevant whether you connect by ethernet or wireless.. you want to not be connected. Or to have strong permissions.. and this is now the case.. Sierra and High Sierra hugely increased protection.. which also made network backups a right royal pain in the rear.