blessed are those who are persecuted for righteousness, because theirs is the kingdom of heaven (Matthew 5:10-12)
The word persecuted here is interesting in Greek, it has the meaning persecuted but the meaning to press forward, pursue, run after. Jesus said, "seek first the kingdom of God and his righteousness..." (Matthew 6:33). When we seek his righteousness and are persecuted but continue forward, seeking it above all we are blessed.
... yet having no root in himself but exists continuing for a limited time, now, suffering or persecution comes the word falls away (Matthew 13:21)
To grow one needs to have deep roots, which Paul writes are faith and love (Ephesians 3:17; Colossians 2:7). And there is a greater love in Christ that can not separate us from him, thus a stronger bond. There is a growth process that matures a child, to a young person, to an adult, this is why Jesus gives gifts to the church (Ephesians 4:10-16).
That we grow into the fullness of Christ is our purpose. Being persecuted for righteousness' sake is about this, when we seek to be like Jesus, to mature into the fullness of his image, we seek first His righteousness. This is when the thorns come to choke us out and what Jesus said would happen, as the enemy has planted weeds among his true children.
all discipline at the time seems not to be pleasant, rather painful, but later yields fruit of righteousness to the ones trained through it (Hebrews 12:11)
We think persecution is more mostly resistance when spreading or teaching the gospel or when it happens going to a foreign land... and this is true. But we are disciplined for righteousness' sake, so that we bear fruit of righteousness. "And this I pray that your love abounds more and more in knowledge and all discernment to the extent you prove what is essential so that existing pure and without blame..." (Philippians 1:09-11). The point of the thorns to keep us from maturing, becoming more like Jesus.
for once existed darkness now at the present light in the Lord, walk like as children of light, (for the fruit of light in all goodness, righteousness, and truth) proving what is pleasing to the Lord (Ephesians 5:8-10)
God is working out all things for our good, so that we are being conformed to the image of his Son. Jesus is the righteous one and through his sacrifice we are justified and receive the gift of righteousness (Romans 5:17). But we still live in a fleshly body in which sin dwells and evil is near (Romans 7:15-25). So the flesh through the influence of evil, works against the Spirit, working against us bearing fruit of righteousness.
work out your salvation with fear and trembling... (Philippians 2:12)
The righteousness that is inward because of the work of Christ and the new birth of the Spirit needs to be worked out in our soul. We are to be trained in discipline to bear fruit of righteousness. We are to work out putting on the armor of God. This is how we build endurance which has the intended work to mature us. So as the trial comes seek first his righteousness.
That is why we have as the most important mission to seek first his righteousness, which Paul calls our reasonable service (Romans 12:1-2). Peter calls this the goal of faith the salvation of our soul (1 Peter 1:19) and why he writes do not think it strange when a trial comes upon you, a trial by fire, because God is proving your faith, maturing you, and refining you to be more like Jesus.
and if children then heirs, heirs with Christ, provided we suffer with him so also glorified (Romans 8:17)
There is no life unless the seed dies and germinates to produce new life. To be glorified, become like Christ, we must suffer with him. When Paul writes he preached Christ crucified, he is talking about seeking first his righteousness, so the flesh and its sinful desires opposed to righteousness is rendered useless, crucified and united and having fellowship in Christ's suffering. This is why Paul could write, I am crucified with Christ, I no longer live [in the flesh] Christ lives in me, I live by faith in the son of God, the one loving me and giving himself for me (Galatians 2:19-20).