CSS - How do I select children of sibling elements?
What you want to do is not possible with current available CSS selectors as you've already noticed.
You can check if this :focus-within
workaround would work for you (browser support is very good, with IE being the usual exception):
.wrapper:focus-within + .wrapper > #last-name {
background: yellow;
}
<div id="name">
<div class="wrapper"><input id="first-name" type="text"></div>
<div class="wrapper"><input id="last-name" type="text"></div>
</div>