Custom ULID type as UUID column trouble with native PG UUID adapter

Hello here!

I’m trying to define a custom ULID type mapped to UUID PostgreSQL column.
My first attempt is here.

All is good (Foo.create! just create a correctly ULID primary key) until I start to play with relations.
foo.bars.create! just fail because foo_id is kept to nil and this is not expected.

After digging into the code, the current trouble seems the standard UUID mapping here still apply.
There is a ULID type as value input (as expected?), and so the value = value.to_s give a ULID 01J55QD98VDB4AT5A5P24MVQP2 instead of the corresponding UUID 01914b76-a51b-6ac8-ad15-45b0894ddec2.
Then it’s just totally ignored because don’t match the expected UUID format, return nil instead of raising error, and the final insert is rejected by the database.

I’m surprised by the fact the internal UUID PostgreSQL custom type is still applied, and only on relations. I expect my ULID custom type would be the only one in charge of the serialization to and from the database.
Seems on the contrary the UUID raw column value is processed by the UUID pg adapter first, then by my custom type.

Is there any way to achieve such custom primary/foreign key type with no interference with another internal activerecord adapter?