This is a "revision" of this question, it contained an error I now see. In a nutshell, I was wondering if in the halting problem proof the decider $D$, after recognising its source code in the input fed to it, could leverage the fact it can look at the source code of $H$ to help its clone in the input make the right prediction if the simulation was run. By treating the "clone in the input" effectively as the same as itself and therefore helping it out, $D$ would manage to make the right prediction even in the case what is going on in the simulation from the input is happening to the original $D$ too, and there actually is a real $H$ trying to trick it. The question I linked to explains the idea more thoroughly and (maybe) more clearly, but at its core the idea was about $D$ realising that its "clone" described in the input would do the exact same things that the original $D$ does, so $D$ starts acting as it was its clone with the intent of saving it from being tricked.
The error I made in the first question was to think that when programming $H$ you have a set of finitely many possible halting states to choose from, and that therefore $D$ could be programmed to possibly halt in any of the states in this set, so that after reading $H$'s source code it could simply choose to end in that state to ensure halting.
What I am wondering now is: couldn't $D$ still ensure halting of $H$ by using a more sophisticated technique? I'll try and explain more or less what I mean. Sorry for the lack of rigour and the very cloudy outline, please let me know what points need to be clarified the most.
Even if $D$ cannot directly terminate in $H$'s halting state, maybe it could trigger $H$ to decide to halt itself by tricking it into believing the "not halting" prediction was made by $D$. Imagine in the physical implementation of the Turing machine the halting prediction is made by printing 0 or 1 in some special square. The special square is easily recognisable from the external world maybe because the tape has some mark on the other side at that position, or (as in Turing 1936) the special square is the one immediately to the left of where the machine description given as input begins. $H$ cannot see the external world and it has to orient itself only based on the landscape of zeros and ones that $D$ left behind after halting. Now, $D$ can be as intelligent as we like, and had both complete access to $H$'s source code and all the time it needed to learn about it, and crucially it can deduce that everything that it does is what its alter ego described in its input would do if the simulation was left running (even if it obviously it can't run the whole simulation because of infinite recursion). Couldn't $D$ be able to arrange some portion of the tape in such a way that after it halts and $H$ is triggered, $H$ is tricked into thinking it is experiencing a reality where the special square says "not halting"? But actually the landscape that $H$ is using to orient itself is some sort of "virtual machine"/"virtual reality" built by $D$ and the true special square is in another part of the tape. By the way, I think this argument can be adapted even to the slightly different framework found in the original Turing paper (circular and circle free machines).
If we take away the ability to keep track of some special square from the outer world, and you ask whether $D$'s prediction can be accessed by any other subroutine/agent existing inside the universe run by the Turing machine, then I think the answer is no. But I also think that subroutines/agents can be built in such a way that they can access the actual prediction ($D$ won't lie to them) and use such information to do anything consistent with the assumption of $D$ being a universal decider.
One objection I see is "what if we make $H$ very intelligent too, so much so that it is always able to fight back and be one step ahead of $D$, hack trough the virtual machine built to trick it etc...? Here I think there is still a crucial problem: $H$ to win has to behave in a way that contradicts what has predicted the simulation of itself will do if left running, while $D$'s goal is compatible with staying coherent with the simulation of itself. What I mean is that at the very beginning $H$ will try to analyse the source code of the subroutine $D$ to understand its behaviour and avoid being tricked by it. But $D$'s behaviour is contingent on what course of action $H$ in its input will take to try and retrieve $D$'s true answer. This course of action has to be exactly predicted by $D$ if it is really a universal decider, then $H$ has to exactly predict $D$ and all of its predictions and yet somehow manage to do something that $D$ predicted it would not do in those circumstances, which is a contradiction. But note that this is not a proof by contradiction that $D$ must not exist: we made two assumptions, the first one is the existence of $D$ and the second one is the existence of this super powerful $H$ always capable of being one step ahead of $D$. Therefore, this is only a proof by contradiction that at least one of these two assumptions must be false.
So my question would be: can $D$ trick $H$ in the way I described? Can you spot any reason why my argument falls apart?
Edit: I got why the previous argument doesn't work. But, in my understanding $H$ has to copy-paste its input (or print it as quines do) to duplicate it and give the two copies to $D$, so I was wondering what would happen if $D$ realises that it has the power to decide if $H$ halts or not and stops trying to predict the behaviour of machines described by its input and treats those descriptions as simply some strings (disregarding they encode a machine description). Maybe the copy-paste procedure leaves in those strings some information about something like how many $H$ calls is some $H$ call nested in, so that $D$ can create some behaviour coherent with the predictions. Suppose you have a set of strings, all are meant to be equivalent descriptions of $H$, but each one pops up as description of $H$ only when $H$ is called inside itself some specific number n of times, then if $D$ alternates predictions back and forth (string1:halt, string2:loop, string3:halt etc...) depending on the number of nested calls, its predictions would be true. I started to wonder about this because it looks like to have a description of itself printed/copied in the exact same way the machine is actually implemented and then simulating it with a universal Turing machine, you need more complexity than you have, am I wrong?