SI-8607 Fix erasure for value class inheriting from private class

Details in the commits.

Here's the full diff of scalac logging output to explain
how we led into the crash:

   https://gist.github.com/retronym/e533b3f35d6b5288c36b