Compare:
select json_extract_array_element_text('["Sandwich", "Omelette", "Tikka Masala"]', 0)
In Redshift, that gets you an unquoted Sandwich, in docker-pgredshift that gets you a double-quoted "Sandwich".
Adding .strip('"') to the json.dumps seems to solve it:
CREATE FUNCTION json_extract_array_element_text(json_array text, array_index int) RETURNS text immutable as $$
import json
result = json.loads(json_array)[array_index]
return json.dumps(result).strip('"')
$$ LANGUAGE plpythonu;