Even if you self-host matrix there are still multiple ways you could be liable for content you don't even know exists. Especially the last 4 points here:
https://telegra.ph/why-not-matrix-08-07
There are even custom message/media types that people use to upload hidden content you can't see even if you're joined to the same channel using a typical client.
Has this actually happened, or is it hypothetical? Was a server operator held liable for merely holding cached images?
Edit: It seems I've suddenly been rate–limit banned.
Does matrix self-hosting allow you to disable federation & uploads?