Obviously there must be more to Yehoshua being chosen than a play on the words yarei – yarei. All of the shevatim were yirei shamayim -- just because these words did not come out of their mouths does not mean their character was lacking. So why were Yosef and his descendants alone charged with leading the war against Amalek?
Ksav Sofer answers that, as we discussed in the past, war against Amalek has to be waged l’shem shamayim. When we fight Amalek it must not be done out of animosity or hatred, but rather simply to fulfill “milchama l’Hashem,” for Hashem’s honor alone. Yosef surely had motive, means, and ample opportunity to take revenge against his brothers for their crime of selling him into slavery. Had Yosef wanted to be vindictive, he certainly could have justified his actions. Yet Yosef put aside his personal feelings and chose not to lash out at his brothers. Any pain he caused them was done l’shem shamayim to see the dreams/prophecy foretold to him fulfilled. It was this quality of selflessness, the ability to put aside personal feelings and act completely l’shem shamayim, which made Yosef and his descendants the best candidates to carry out this "milchama l'Hashem" against Amalek.
Where did Yosef get that quality from? I think it came from his mother Rachel, who put aside her own desire to be Ya’akov’s wife and gave the simanim to her sister Leah to spare her the embarrassment of being rejected by Ya’akov when he realized that Lavan had switched their places. Rachel gave away everything l'shem shamayim; her children inherited that quality.
Perhaps there is another reason Yosef was chosen as a foil for Amalek. Amalek was among the offspring of Timna. Chazal (Sanhedrin 99) tell us that Timna was a princess who came to the Avos and wanted to convert and join Klal Yisrael, but the Avos rejected her. She therefore went to Eisav and ended up marrying Elifaz, Eisav’s son, and giving birth to Amalek. Timna was pushed away from the family of the Avos and the result was Amalek, “lo yarei Elokim.” Yosef was pushed away by his brothers, but rather than abandon his yiras shamayim, he only grew stronger, “es haElokim ani yarei.”
After the battle ended Moshe erected a mizbeiach which he called “Hashem Nisi,” G-d is my miracle. Ksav Sofer asks why Moshe erected an altar on this occasion alone – why did he not do the same after leaving Mitzrayim or after the splitting of Yam Suf?
Ksav Sofer answers that the victory against Amalek was not an overt, supernatural miracle like the plagues or the splitting of the sea. For all intents and purposes it looked like any other war between two armies. Moshe therefore built a mizbeiach and named it “Hashem Nisi” to publicize the fact that miracles do not always come in supernatural garb. For a rag tag “army” of just escaped slaves to stand up to a full scale surprise attack by an enemy dedicated to their destruction was also indeed nothing short of miraculous.
I would like to suggest that Moshe’s actions go hand in hand with the selection of Yosef’s sheivet to lead the war. Yosef’s outward appearance was that of an Egyptian viceroy. He probably dressed Egyptian, he certainly spoke Egyptian, and he was able to move in the highest strata of Egyptian society, yet inside burned the neshoma of “es haElokim ani yarei.” The war against Amalek on the surface looked like any other war, but below the surface it was a “michama l’Hashem” involving hashgacha/nes. According to the Netziv, the entire objective of Amalek is to blind us to the hasgachas Hashem, to prevent us from seeing the many miracles that surround us every day. Yosef’s message is to look below the surface. Even if you don’t see a thunderbolt shoot down from the sky or the sea split, Hashem is still there working miracles behind the scenes. Finding those hidden miracles is how we defeat Amalek.