Is it possible to use the jsonb field as foreign_key in the belongs_to association? Sort of:
belongs_to :product, class_name: "Product", foreign_key: "data ->'product_id'"
Links can only be defined between columns (or groups of columns), as indicated in the documentation :
FOREIGN KEY (column_name [, ...]) LINKS reftable [(refcolumn) [, ...])]