Be careful of taking a particular Scripture verse used in a particular situation and trying to apply it universally. For example, some people try to use the thief on the cross being forgiven and going to paradise to say that baptism isn’t required without taking other verses into account.
It would be an extreme to say that everyone has full knowledge of what they are doing is sinful and should be punished to the full extent of the law. Yet, it would equally be an extreme on the other end to say that no one has knowledge that what they are doing is sinful and therefore should not be punished for their sin.
To say that we could never be informed enough for it to be a mortal sin would not right. For instance, I heard from Fr. Mitch Pacwa on EWTN say that murder is always a mortal sin. Murder, the unjust killing of an innocent life, is something that intrinsically goes against our God given conscience. So our conscience informs us that it is a grave sin. And, if we deliberately go against our conscience here then it is a mortal sin.
The catechism teaches that there are 3 elements required for a sin that is considered grave matter to become mortal:
"Grave Matter: The act itself is intrinsically evil and immoral.
Full Knowledge: The person must know that what they’re doing or planning to do is evil and immoral.
Deliberate Consent: The person must freely choose to commit the act or plan to do it." reference
For Jesus to say that those crucifying didn’t know what they were doing was in fact accurate. St. Paul says:
“Yet among the mature we do impart wisdom, although it is not a wisdom of this age or of the rulers of this age, who are doomed to pass away. But we impart a secret and hidden wisdom of God, which God decreed before the ages for our glory. None of the rulers of this age understood this, for if they had, they would not have crucified the Lord of glory.” (1 Cor 2:6-8)
St. Paul describes these rulers as being ignorant of the wisdom of God. Yet, St. Paul does not excuse them but says they are doomed to pass away in verse 6. Doomed to pass away assuming they do not come to a repentance.
I can’t imagine a worse sin than murdering the Son of God. The soldiers were perhaps the most innocent if they were simply following orders to crucify a criminal without any knowledge of who this person was or that he was being innocently condemned. The rulers St. Paul mentions could be talking about the religious leaders who plotted to kill Jesus. Nonetheless, Jesus is concerned for their salvation more than he is of taking any sort of revenge for the wrongs done to him. This shows God’s desire to be merciful and just. If only the seriousness of the offense were taken into consideration they would have no chance of salvation.
Note that Jesus said that for our benefit, not his. St. Stephen follows in his footsteps by praying for his persecutors as they stone him in Acts 7.