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
@egilburg also this does not only catch common prefixes but also common suffixes. For example with:

```ruby
["popular_artists", "upcoming_artists"].sort.flat_map {|t| t.split('_') }.uniq.join('_')
```

It will result in `popular_artists_upcoming`.