How to add all combinations of two pairs of key-value to a table?
INSERT INTO Pairs
SELECT DISTINCT NULL, t1.KeyID, t1.ValueID, t2.KeyID, t2.ValueID
FROM ItemKeyValues t1
JOIN ItemKeyValues t2 USING (ItemID)
WHERE t1.KeyID &lt; t2.KeyID;


INSERT INTO ItemPairs
SELECT t1.PairID, t2.ItemID
FROM Pairs t1
JOIN ItemKeyValues t2 ON t1.Key1 = t2.KeyID 
                     AND t1.Value1 = t2.ValueID
JOIN ItemKeyValues t3 ON t1.Key2 = t3.KeyID 
                     AND t1.Value2 = t3.ValueID 
                     AND t2.ItemID = t3.ItemID;


fiddle

PS. I have simplified your structures by removing indices and options.

PPS. Your DDL scripts pack contains at least 1 error (copypaste misprint?).