Zuraczurx pretty much covered it. For file sharing, the Time Capsule (TC) can only support either the AFP or SMB protocols. AFP is now "retired" and the TC only supports SMB 1.0, which is very unsecure.
When I was still using the TC (last time around 2018), even though I managed to connect a variety of USB-powered external drives, there was always "lack of power" issues using them. Even self-powered drives didn't perform much better.
The other issue was poor data transfer rates. You might get away with simple file transfers, but anything that requires high & consistent rates (like streaming video) is pretty much dismal at best.
If cost is an issue, the idea of using a Raspberry Pi, is quite doable as it does support SMB 3.x ... but, again be aware, that data transfer rates, will still not be stellar.
The bottom line? If transfer rate performance is critical to you, you basically have two options for Time Machine backups:
- Use a directly attached external drive, and / or
- Use a dedicated NAS that supports Time Machine, like the Synology NAS series.