It works for entity_id because this option expects to receive a string in the form of light.something. Your template succeeds in doing that.
It fails for hs_color because this option expects to receive a list in the form of [10, 45]. However, your template is generating a string that only looks like a list.
Change it to this (i.e. remove the line-continuation character >):
hs_color: [10, {{range(30, 70) | random}}]
The moment the YAML parser sees the > it treats the rest as a Jinja2 template and templates can only generate strings.
EDIT
The correct version, which passes Config Check, is actually:
The latest example you posted is unlike the previous one. The template for entity_id defines a variable called h which you then attempt to use in the template of the hs_color option. You can’t do that. The scope of a Jinja2 template is limited to the option where it is defined.
Also, the transition option should be indented so that it aligns with the other options under data_template.
It is YAML which is parsed by Python and then also parsed by Jinja template parser.
In my original configuration hs_color: [10, {{range(30, 70) | random}}]
was ready by Python, but with an error because [] didn’t contain a valid list.
After it was changed to (mind the quotes) hs_color: [10, "{{range(30, 70) | random}}"]
it became a valid list of [int, str] after which the str was parsed by Jinja.