For what it's worth, killing and restarting explorer on Windows 10 as of this date (2024-04-15) worked for me to restore the taskbar to autohiding:
taskkill /F /IM explorer.exe & explorer
taskkill /F /IM explorer.exe & explorer
There is, as of this writing, no proper fix to this problem and as near as I can tell, Microsoft has not even acknowledged that it is an issue.
In recent years, software manufacturers have taken to ducking some of the most irritating bugs by saying that they are 'by design'. This is not an explanation and it does not in any way absolve them of correcting the issue. SideRant: I have more confidence in my opinion of this matter than I do of theirs. I have been writing software for decades and have worked with every version of Windows since version 2 (before 3, 3.1, 95, 98, ME, 2000, XP, 2003, and 7). I also work with Linux and have worked with various other Unices over the years. I have worked with a fair number of software vendors (including Microsoft) on their projects (that is, they hired me). I have also worked with just about every type of business in the fortune 100. I have written hundreds of thousands of lines of code personally in most major languages (notable exception LISP) and all major types of languages (including LISP-variants). My experience spans from hand-entering op-codes, through development of device drivers in assembly code, windowing subsystems, systems programming, low and high-level libraries of all types, utilities, parsers, generators, high-level application code, communications, etc. I have worked alone and in teams following a variety of development regimes.
By my way of thinking, the task-bar in Windows 7 is plainly broken and I have no hesitation about it. It is buggy. It does not work properly. This issue is at minimum a bug. It is more likely even worse. It appears to be a design flaw. In fact, it appears to be one of the class of very nasty design flaws that stem from a broken design philosophy. In this case, the philosophical point of view (with which I strongly disagree) is that any userland process can insist that a user interacts with it and can suspend normal operation of the system until they do so. Looking at it from another point of view, it gives user input too low a priority -- essentially below that of any other executing code on the system.
In the case of the taskbar bug, it means that when programs enter a certain state, they can force you to stop your work and start an investigation to determine which program has which need and then attend to it. In the event that you cannot determine this, your option is to permanently unhide the taskbar (uncheck auto-hide) or to reboot. In some instances, unhiding the taskbar means that you can no longer use the system because you lose vital screen real estate necessary to (say) click the 'Apply' button on the very dialog necessary to change the auto-hide option. That is, you can get the system into a state where the only option is to reboot, just because one of the weaker programmers to provide software to your system wrote a program that put up the wrong type of message.
There is no reasonable work-around for this problem. The only thing likely to help this problem if you have it bad is a program that periodically forces the taskbar to hide. Such programs apparently exist, but they are a poor workaround.
If you look far and wide you will see the usual variations of helpful stuff like:
"it rarely (or never) happens to me"
"I tried [insert kludgy partial workaround] and it worked for me]"
"Just reboot"
One of the more irritating idioms that appears in Microsoft forums goes like this:
You: "How do I fix the taskbar so it will always auto-hide"
Them: "I don't understand why you want that."
or
Them: "You shouldn't want that."
or
Them: "The reason why it is irretrievably and senselessly broken beyond all recovery and will always interfere with the proper operation of the system is [insert unconvincing reason here]"
Normally, I like to give a workaround, but in this case, there is none and it is uncertain how it can be fixed properly by anyone other than Microsoft. The problem is that there is a function in the Operating System (Windows) that might as well be labeled 'risk breaking the system on a whim' that gets called willy nilly by any program that pleases. In fact, it may be that the effect is buried in a different call that might as well be labeled 'do not ever allow the system to break'. A well-meaning but naive programmer with a less than effective testing regime might be attempting to make their program behave well by calling the 'do not ever allow the system to break' function and ironically breaking the system.
I will update this in the comments if/when I come up with a reasonably satisfying solution. However, since this problem has existed for many years, I am not holding my breath.