So the condition is "that everyone who looks to the Son." So how did not those in Matthew 7:22-23 do so?
So, the “condition” that everyone look to the Son, or everyone who does the will of the Father is not a condition for “election”. It is a condition for seeing the Kingdom of Heaven.
These are two very different things.
How do they meet this condition? I will explain what I believe, which is supported, imo, by scripture.
The person is created for that purpose by God (Romans 9). Prior to salvation (a right relationship with God) the person is as lost as anyone else.
God Holy Spirit intervenes in that person’s life, “regenerating them”. This means that they are now free from sin in the sense they are enabled to see and understand the truth about their lost condition before God and their need for a Savior. God Holy Spirit also convicts that person of the Truth of Jesus, Who He is and His sacrifice on the cross and His resurrection.
This is referred to as being “drawn” by God. Jesus refers to it as His sheep hearing His voice and following Him. (John 10).
The person, now seeing the truth of Jesus, His heart is softened by God and he/she responds to this work of God by faith in Christ, Who He is and what He has done.
Without God’s intervention, this person, chosen by God for salvation, would never have faith to believe. It can be rightly observed that God, Himself, is the cause of the faith now present. God has given us faith to believe.
The person now is enabled to meet the condition of looking to the Son / doing the will of the Father and will, therefore see the Kingdom of God.
The “condition” therefore will be met by the elect, but the condition is not a condition to become the elect.
peace to you