SERVER-74124 introduced the code to disallow shard keys that contain parts that start with '$'. It turns out that check is too strict since it is valid to shard with a shard key with DBRefs (i.e. $id, $db and $ref).
is caused by
SERVER-74124Disallow sharding with wildcard shard key pattern
SERVER-77255Shard key field validation for DBRefs prohibits extra dollar-prefixed fields