But yeah, I guess with docker it's complete anarchy ( the bad kind of)
Not really, usually stuff will be all self contained (no pun intended), container volumes inside docker's own directory and mounts of folders that will most often all reside under the same repository, then you don't have to worry about breaking stuff by touching the root, even better if you do that with Podman.
Flatpak is similar in the way that it also has its own standards and apps are pretty much obligated to follow them. Now the fact that data lives under .var/app/
completely disregarding the XDG spec, while both things are part of Freedesktop... Well that's just ironic lol