How can I dynamically set the site URL (in Drush9+)?
I don't see how you can easily reproduce that (nice) configuration setup since the yaml files are indeed static.
The only solution I see is to write a little wrapper script that always calls drush with the --uri option, like:
drush --uri $MY_SITE_URL_VAR $@

Recommended solution
A much simpler solution is to use the shell variable DRUSH_OPTIONS_URI.
export DRUSH_OPTIONS_URI=http://example.com

I wasn't able to find any documentation for this, but it seems to work.