Fixed the inferred table name of a HABTM auxiliar

table inside a schema.

Fixes #14824.

This PR relies on https://github.com/rails/rails/pull/14871 being merged in to run.

I would gladly appreciate any feedback on how to properly create a schema for a test case because I don't think what I did follows protocol.