My 2023 Model S is set to fold the mirrors when I approach my garage, and that works 100% of the time. The mirrors are supposed to unfold when I leave my garage, and sometimes they do right away, sometimes they do further away, and sometimes not at all. My 2018 Model S did not have that issue.
If you want your mirrors to unfold as soon as you put the car in gear, enable the Mirrors Auto Fold option. I don’t do that because I don’t want my mirrors to unfold before I back out of the garage.