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
Alternative implementation (not sure if handles all edge cases as regex one, but IMO clearer and faster too):

```ruby
[first_table.to_s, second_table.to_s].sort.flat_map {|t| t.split('_') }.uniq.join('_')
```

Benchmarks:

```ruby
first_table = 'music_artists'
second_table = 'music_records'

require 'benchmark'

Benchmark.bm(20) do |x|
  x.report("regex") do
    1_000_000.times do
      [first_table.to_s, second_table.to_s].sort.join("\0").gsub(/^(.*_)(.+)\0\1(.+)/, '\1\2_\3').gsub("\0", "_")
    end
  end

  x.report("flat_map_uniq") do
    1_000_000.times do
      [first_table.to_s, second_table.to_s].sort.flat_map { |t| t.split('_') }.uniq.join('_')
    end
  end
end
```

```
                           user     system      total        real
regex                  8.240000   0.020000   8.260000 (  8.264134)
flat_map_uniq          6.450000   0.010000   6.460000 (  6.464470)
```