Replace returns a string - but this is a string value, not a string as part of your query.
What you can do, instead of using IN, use REGEXP to match in your source string, for example:
vals REGEXP '[[:<:]]4[[:>:]]'
, "4", ( , 3 | 44 | 100, "4", "44" ).
[[:<:]] [[:>:]] - " " " " .
, - ...
CONCAT('[[:<:]]', CAST(id AS CHAR), '[[:>:]]')