Does a UNIQUE constraint implicity contain the primary key?
Yes and no.

Yes in that the PK column(s) are tacked onto each UNIQUE index and the INDEX implicitly generated by each FOREIGN KEY.

No in that the PK column(s) are not part of the uniqueness constraint implied by UNIQUE.

For example:

PRIMARY KEY(id),
UNIQUE(x)


is like

PRIMARY KEY(id),
INDEX(x,id) and a uniqueness constraint on only `(x)`.


FOREIGN KEY(y) will generate INDEX(y) unless it finds an existing index starting with y.