At first his disciples did not understand all this. Only after Jesus was glorified did they realise that these things had been written about him and that they had done these things to him.

The disciples did not understand at that time (2:22; 7:39). They needed the revealing of truth by the Holy Spirit to help them (16:13-15) and so it is with non-Christians even today. Without the help of the Holy Spirit, the things Jesus did and the things He said can never be understood. After His glorification , His disciples understood Him to be King in the correct sense of the word.

John 2:22  After he was raised from the dead, his disciples recalled what he had said. Then they believed the Scripture and the words that Jesus had spoken.

John 7:39  By this he meant the Spirit, whom those who believed in him were later to receive. Up to that time the Spirit had not been given, since Jesus had not yet been glorified.

John 16:13-15  But when he, the Spirit of truth, comes, he will guide you into all truth. He will not speak on his own; he will speak only what he hears, and he will tell you what is yet to come.  He will bring glory to me by taking from what is mine and making it known to you.  All that belongs to the Father is mine. That is why I said the Spirit will take from what is mine and make it known to you.