well what's happening here is fairly simple, the mapper and ORM don't know anything about the conversion from string to UUID. So when you pass it Data(uuid="some string"), it persists it, passing it off to the Core which converts the UUID, but because you've supplied the primary key, it then assumes the "key" for this object is "some string", not the UUID object, and places it into the identity map with that string identity. Upon loading the first row from the database, that row comes back with UUID("some string") instead, so now you have two different identities in the identity map.
I don't actually use UUIDs for primary keys, I spent a year with one project that did and it was definitely a mistake, so these days I tend to have the UUID as a supplemental identifier for use in web services and such, but not as the internal primary key, which is why that recipe doesn't have any note about this - but also I don't use the string coercion you see here; if I'm dealing with a UUID I'd normally make sure it's a UUID the moment it enters my application (like if it were in a web form, the form library would coerce it).
Anyway, the immediate solution to this test would be to make sure the value is coerced at the ORM level, most simply by using a @validates decorator.