A - Thanks for the question. We need to define some terms first.
Self-defense is self explanatory, but for the sake of the argument, we will define it as a legitimately defending yourself from aggressive harmful action.
Martyrdom - is bearing witness to the faith even unto death.
In some cases we are obligated to defend ourselves. The Catechism states:
2265 Legitimate defense can be not only a right but a grave duty for someone responsible for another's life.For example, as a father I am responsible for protecting my children and would be obligated to do so if they were threatened with harm, and if necessary, I would have to take the life of another to protect them.
Now, martyrdom is different. it is offering your life for God when the only other choice would be to abandon the faith.
Now that we have established the difference between the two, we can see that there is no contradiction between them. The overall principle that informs both is that the earthly life is precious, but not more precious than eternal life. We have to seek to preserve lives we are responsible for, if possible, but if the only option were to die bodily or deny the faith, then the primacy of the spiritual life takes precedence.
Blessed Miguel Pro was killed because he was Catholic. He was hunted down, accused falsely of a crime and executed. Knowing there was nothing that would save him, he willingly witnessed to the faith by not taking a blindfold and before he was shot by the firing squad he declared ""Viva Cristo Rey", "Long live Christ the King".
Off topic a bit - Bishop Placido Rodriguez of Lubbock tells some cool stories about Blessed Miguel Pro. Bishop Rodriguez's father was member of the resistance movement against the anti-Catholic government that persecuted the Church - he also knew Blessed Miguel Pro.