he loved them to the end

[1] Now before the Feast of the Passover, when Jesus knew that his hour had come to depart out of this world to the Father, having loved his own who were in the world, he loved them to the end.
[2] During supper, when the devil had already put it into the heart of Judas Iscariot, Simon's son, to betray him, [3] Jesus, knowing that the Father had given all things into his hands, and that he had come from God and was going back to God, [4] rose from supper. He laid aside his outer garments, and taking a towel, tied it around his waist. [5] Then he poured water into a basin and began to wash the disciples' feet and to wipe them with the towel that was wrapped around him
John 13:1-5

Jesus didn't wash the disciples feet to teach them a lesson or shame them. He didn't do it to provide an illustration to be used by Christians for the next few thousand years. He did it because he loved them. 

It was a disgusting task and he didn’t want his friends, who he loved, to have to do it. So he did it.