It simply can't really infer based on your context the exact accessibility needs and requirements for the code. It can generalize, and yes, shifting focus can sometimes be good for a form field, like when you open a new dialog, or just a user action triggered it to happen for the specific scenario of the page. Even for error management it can work, if you aren't alerting and it's a simple form, but it fails to get the nuance of what those two things as an experience create.