I found it much easier to assign a class to the input field (in my case they are created dynamically).
<input
class="d-inline texts"
matInput
formControlName="text"
>
Then I just applied the following pure javascript to autofocus on the last input field created:
setTimeout(() => {
const elementsByClassName: any = document.getElementsByClassName('texts');
elementsByClassName.item(elementsByClassName.length - 1).focus();
}, 0);