Hi, and thanks for writing in. It's actually possible to delete messages from spaces you're not in. If you head to the Privacy section of settings and scroll to the bottom, you're able to delete your messages. See the attached image.
I will leave this post open regarding the prompt of when you are removed from a community though.
Thread
Comment by mesub
pasted-image-1.png
467×341 | 46 kB Link to pasted-image-1.png
Comment by aonia:niri:wl:/usr/libexec/aonia