I don't think there is a built in method for that. Easiest way I can think of is the plpgsql function you wanted to avoid:
CREATE OR REPLACE FUNCTION str_eval(text, OUT t text)
LANGUAGE plpgsql IMMUTABLE STRICT PARALLEL SAFE AS
$func$
BEGIN
EXECUTE 'SELECT E''' || replace($1, '''', '''''') || ''''
USING $1
INTO t;
END
$func$;
The updated version safeguards against SQLi and is faster, too.