Besides stressing that the verse mention that the gallows were prepared “for him,” R’ Shlomo Kluger in Ma’amar Mordechai points out that in order to be consistent with Zeresh’s advice earlier (Esther 5:14), the verse should have written “asher asa lo” (“that he made for him”) instead of “asher heichin lo” (“that he prepared for him”).
The Talmud (Megillah 16a) explains that the gallows Haman had built were prepared in the ironic sense that they would unintentionally be used for his own hanging.
The Vilna Gaon explains that, as opposed to something whose purpose changes, the gallows were never meant for Mordechai at all, and were always for Haman. Some things historically had an intended purpose, and were then appropriated for some other use. T.N.T., for instance, was meant to be used solely for construction. Its being adopted for use in war so traumatized its inventor, Alfred Nobel, that he developed the Nobel Peace Prize for those who allegedly bring peace to the world. These gallows, by contrast, from their inception, were always intended for Haman’s downfall.
R’ Dovid Feinstein explains that the gallows had to be a perfect fit for Haman, since he and his sons all fit on the same gallows (see Targum Sheini to Esther 9:14). See attached chart.
According to the opinion that the gallows were made from the beams of the Beis HaMikdash, the Ben Ish Chai asks how Mordechai could have the right to use them as he will when he hangs Haman (Esther 7:10) since he would thereby desecrate these holy objects (Pirkei D’Rebbe Eliezer 50). However, answers the Ben Ish Chai, Haman’s using the beams first took away their sanctity, preparing the beams for use in his own death.
Using Newtonian physics, the Maharal points out that if an object that is thrown at a wall drops straight down upon impact, this shows the amount of force applied by the thrower. However, if the object bounces back upon impact, this means the thrower applied more force, and it was only the wall’s strength that kept the object from its intended place. Similarly, in yet another example of mida kineged mida, what happened to Haman (and his sons) reflects the vehemence with which they planned to dispatch Mordechai.
According to R’ Yehonason Eibshutz in Yaaros Dvash, Haman intended hang a completely different “him” – the king. After all, Haman had planned a conspiracy to take over the monarchy.
On a Halachic point, the Chasam Sofer notes that hachana (“preparation”) usually implies in the legal world preparing for the next days. In this case, where Haman prepared the gallows earlier that morning, why is this hachana for the same say? He answers that hachana for gentiles does not need to be for the next days since the Talmud describes them as “holech achar hayom,” that they follow a solar schedule, controlled by the sun.
The Belzer Rebbe adds that Halacha recognizes the need for mitzvos to have hachana; this is not true for sins. For example, consider how much planning you needed to put into learning right now, versus how much planning you would have needed to waste your time in front of a tv or computer screen, instead. Therefore, the gallows must have been for Haman since killing out the nation of Amalek is a mitzvah (Rambam, Mishneh Torah, Hilchos Melachim 6:4).