I tried to write a bashrc extension, that unmounts the /var/tmp/portage ram disk based on a blacklist of packages that are to big to compile in ram. During that I noticed, that I have no chance doing that, because at least the lockfile is already written to the $WORKDIR when the /etc/portage/bashrc get first sourced and so that ram disk cannot be unmounted from bashrc because it is busy.
(Testing with =sys-apps/portage-2.2_rc67. Should be the same problem with older versions.)
Would be nice if it is possible to source that file once earlier with EBUILD_PHASE maybe pre_ebuild or something like that.