Make create_join_table use the same logic as HABTM reflections

Closes #13683.

`create_join_table` and the HABTM associations used different logic to decide what name to generate for the join table. Given the models `Music::Artist` and `Music::Record`, one would go for `music_artists_music_records`, while the other for `music_artists_records`. This change unifies the logic and extracts it to the same place.

We were not sure where to extract the common logic. We chose `ActiveRecord::ModelSchema` because it has similar table name computation logic. Feel free to suggest a better place.

/cc @senny
Cool idea!

I think it introduces a regression, though. It's a contrived example, but suppose you have two HABTM models – `Cheese` and `CheeseBox`. Their respective table names are `cheese` and `cheese_boxes`. The regexp version will produce `cheese_cheese_boxes`. The flat_map_uniq version (`cheese_boxes`) will collide with one of the original tables.

Another pair of model names that will problematic is `User` and `UsersGroup` (note the plural).