Complete shot in the dark, but maybe try removing the cleanup part to see if it works?
And does the following(ish) line appear in the build logs? This is for Java 11 but should look pretty similar.
Copying needed symlink target '/etc/ssl/certs/java/cacerts' from host to satisfy '/root/parts/osrs/install/usr/lib/jvm/java-11-openjdk-amd64/lib/security/cacerts'.
Otherwise just on the side, I think your PYTHONPATH variable isn’t having an effect anymore, core20 uses 3.8 not 3.6