Currently, a SerializableEntityId’s string representation is its serialization, which means it’s equal (==) to its serialization string.
>>> ( new \Wikibase\DataModel\Entity\ItemId( 'Q1' ) ) == "Q1" => true
This means that tests involving entity IDs are less strict than they should be: assertEquals( new ItemId( 'Q1' ), $actual ) will pass if $actual is a string, even if the test meant to expect an ItemId. This can hide real bugs: see T293104 for an example.
The comment of the __toString() method mentions that “[t]his format is allowed to change and should therefore not be relied upon to be stable”, but in practice we have plenty of tests (and, presumably, non-test code) relying on this behavior: see the results of this WIP change (some 40 to 80 failures, depending on the CI job). I suggest that we fix all these places – it’s not an insurmountable number – and then change __toString() to return something that’s still human-readable, but not exactly the serialization (e.g. adding the class name).