Is it science fiction
It’s rather a pulp fiction, as there is no Artificial intelligence yet. So, there is no code that can read your mind and place some variable wherever you wish to.
It’s you who have to mark the spot.
You have to understand that there are many different places where you want to output different variables. And for this purpose you definitely have to name them. Leaving you no choice but calling certain names in your HTML instead of just anonymous # marks.
There are many different syntaxes but the meaning is essentially the same: output some variable here. An easies one is similar to what you have at the moment but way shorter:
<a href='<?= $url_here ?>'>Link</a>
in your place I’d stick to this one for a while.
Trust me, the syntax for the variable output is your least concern. what you should think of is control structures. In any HTML template there are always loops and conditional statements, which syntax is far more sophisticated than a silly variable output. So, that’s a way more important thing to consider.
For example, the links are often go in numbers. And therefore you usually have not one link but an array of data that you wan to format as hyper-links in HTML. Consider this code:
<div class="link-list">
<ul>
<?php foreach ($links as $row): ?>
<li><a href="<?=$row['link']"><?=$row['name']</a></li>
<?php endforeach ?>
</ul>
</div>
this kind of approach is considered the best so far in keeping HTML as clean as possible, while having dynamical data output.
in case you prefer Twig, it won’t be essentially different:
<div class="link-list">
<ul>
{% for row in links %}
<li><a href="{{row.link}}">{{row.name}}</a></li>
{% endfor %)
</ul>
</div>
Note that all the control structures are in place, while differ only in syntax.
You see, the independence is a myth, a delusion. You cannot have your HTML template to be independent from the presentation logic. There is always one. So, this way or another but you have to “pollute” your nice and clean HTML with control structures. The sooner you realize that, the less time you’ll waste.
No offense, but all other answers (save ones mention twig) are but empty musings, inapplicable for the any real life application.