Alias_attribute as primary_key of relation doesn't work anymore

Hello Before rails-7.1.0 i could set alias_attribute field as primary_key, for example:

> class A < ApplicationRecord
>   alias_attribute :connection_id, :id
> end
> class B < ApplicationRecord
>   alias_attribute :connection_id, :other_id
> end
> class C < ApplicationRecord
>   belongs_to :origin, primary_key: :connection_id, polymorphic: true
> end

and it still works if you get single record, like C.first.origin will work correct, but if i’m making C.all.includes(:origin).map {|obj| obj.origin } => [nil] - it wouldn’t load. And it can’t set object via C.first.origin = B.first

is it bug or feature?

I made these changes and it works:

module ActiveRecord::AttributeMethods::Read
  def _read_attribute(attr_name, &)
    attr_name = self.class.attribute_aliases[attr_name] || attr_name
    @attributes.fetch_value(attr_name, &)
  end
end

is this normal, or can cause huge problems?