I've no expectation (or intention) of supplanting the accepted answer, but I would like to add some additional information.
For a start, nobody is a pure functionalist nor a pure intentionalist. Even Goldhagen, who you mention a few times in your question, acknowledges the extent to which the Nazis became progressively more radicalised as the war progressed, and even Goldhagen doesn't suppose that the Nazi party adopted a broad program of physical annihilation prior to 1941.
To complicate this picture, consider that the intentionalism/functionalism dialectic operates both in relation to the NSDAP as a party, and to individual members of that party as people. Even if we were to suppose that the leader of the party had in mind a program of genocide before the war started, that is insufficient to demonstrate that the party itself was structured in such a way as to expedite the fulfillment of that goal.
To speak directly to the substance of your question: how do "functionalists" (bearing in mind that there is also no such thing as pure functionalism) explain the desperate attempts made at the conclusion of the war to continue murdering large numbers of people?
For a start, the widespread murder of people with physical and intellectual disabilities continued in German hospitals well after their occupation by the Allied powers. This is because the doctors responsible for this program were genuinely convinced of its intrinsic goodness. They did not associate euthanasia with murder.
Secondly, the murder of Jews in the final stages of the war occurred concurrently with the murder of other "undesirables", and it was not just Jews who were marched back from the approaching front with staggering casualties.
Thirdly, the desire to murder prisoners at this late stage corresponds with other procedures that the Nazis and their collaborators implemented in order to limit the amount of physical evidence that their murderous campaign had generated.
Sonderaktion 1005 was the code-name given to a widespread program of disinterment, the burning of corpses and the shredding of documents. During this program, death camps at Sobibor, Belzec and Treblinka was dismantled and removed, and the teams of slaves employed in this program were subsequently executed.
Finally, when it became more apparent even to the die-hard Nazi ideologues that the war was over, it was still not necessarily apparent the extent to which they had lost. Many people believed that while they might not be able to hold onto their empire, they will still be able to retain control of Germany, and that they will only be able to do this if they are in a sufficiently strong condition as to sue for peace.
Forcing the Hungarians to participate in the slaughter of their Jewish population was not at all an irrational decision. The Hungarian government (which went through six prime ministers in the time of the war) consistently prevaricated on this issue, and it was clear to observers in Berlin that they were going to join the Allies. Making them complicit in the final solution was designed to prevent that possibility, and to cause them to fight alongside Germany with greater desperation.
The idea that this late campaign damaged the war effort is mistaken, and it is an historiographical error that is only now starting to be corrected. In all instances, "human cargo" destined for Auschwitz took second place to the transport of munitions and soldiers, which is why cattle trains often languished for days on end on railway spurs.