Hm, in that case perhaps bazel isn't a really good fit for your test fixture? I'm no bazel expert so take this with a grain of salt, but at the point where you actively need to juggle UIDs, you may be doing yourself a disservice by relying on bazel specifically.
Another way that comes to mind is to run a script at the very end of your container run that will (inside the container) revert the file permissions to `uid:gid`, thus allowing bazel to remove them once the container is down. While you don't own the existing container (IIRC), you should be able to make a new container using your container under test as base.
F