Not sure if you solved this yet, i wouldnt change your cart actions, you can pass line attributes via the demo add to cart component like this
<AddToCartButton
product={product}
lines={[
{
merchandiseId: selectedVariant.id,
quantity: 1,
attributes: 'RANDOMGENID',
},
]}
>
Add To Bag
</AddToCartButton>
If multiple lines are added in a session the will all have the same id so what be unique ? not sure if this is what you looking for ? if this is what youre wanting then why not give the cart an attribute and not every product, also unsure if this data would possibly be persistent, if you trying to track products added to cart in a single session, that attribute may presist and remain unchanged, if a user starts a new session you may have an order completed with multiple products having different session id's ?