Taken in isolation, it is a bizarre statement that someone with right view goes to hell potentially on account of their right view. It can also be taken to state that good deeds have no corresponding bright karma. Neither of these are correct readings. Here is the full context of the sections of that sutta dealing with a "person who has abstained from killing," etc., and who has "right view," starting at where it outlines the four persons and their destinations:18. (iv) "Now there is the person who has abstained from killing living beings here... has had right view. And on the dissolution of the body, after death, he reappears in the states of deprivation, in an unhappy destination, in perdition, in hell. MN136
The quoted section is dealing with person 4, who obeys the precepts, has right view, and goes to hell. Of that person, the Buddha explains:“Ānanda, these four people are found in the world. What four?
[1] Some person here kills living creatures, steals, and commits sexual misconduct. They use speech that’s false, divisive, harsh, or nonsensical. And they’re covetous, malicious, and have wrong view. When their body breaks up, after death, they’re reborn in a place of loss, a bad place, the underworld, hell.
[2] But some other person here kills living creatures, steals, and commits sexual misconduct. They use speech that’s false, divisive, harsh, or nonsensical. And they’re covetous, malicious, and have wrong view. When their body breaks up, after death, they’re reborn in a good place, a heavenly realm.
[3] But some other person here refrains from killing living creatures, stealing, committing sexual misconduct, or using speech that’s false, divisive, harsh, or nonsensical. And they’re contented, kind-hearted, and have right view. When their body breaks up, after death, they’re reborn in a good place, a heavenly realm.
[4] But some other person here refrains from killing living creatures, stealing, committing sexual misconduct, or using speech that’s false, divisive, harsh, or nonsensical. And they’re contented, kind-hearted, and have right view. When their body breaks up, after death, they’re reborn in a place of loss, a bad place, the underworld, hell.
The Buddha clarifies that this is not correct:Take some ascetic or brahmin who with clairvoyance sees a person here who refrained from killing living creatures … and had right view. And they see that that person is reborn in hell. They say: ‘It seems that there is no such thing as good deeds, and the result of good conduct. For I have seen a person here who refrained from killing living creatures … and had right view. And I saw that that person was reborn in hell.’ They say: ‘It seems that everyone who refrains from killing living creatures … and has right view is reborn in hell. Those who know this are right. Those who know something else are wrong.’ And so they obstinately stick to what they have known, seen, and understood for themselves, insisting that: ‘This is the only truth, other ideas are silly.’
So we know that foolish statements about "all good deeds are naught" is not the point of this passage. The Buddha gives his final definitive explanation toward the end of the sutta as to why someone would observe morality and right view and go to hell:In this case, when an ascetic or brahmin says this: ‘It seems that there is no such thing as good deeds, and the result of good conduct,’ I don’t grant them that. But when they say: ‘I have seen a person here who refrained from killing living creatures … and had right view. And after death, they were reborn in hell,’ I grant them that. But when they say: ‘It seems that everyone who refrains from killing living creatures … and has right view is reborn in hell,’ I don’t grant them that. But when they say: ‘Those who know this are right. Those who know something else are wrong,’ I also don’t grant them that. And when they obstinately stick to what they have known, seen, and understood for themselves, insisting that: ‘This is the only truth, other ideas are silly,’ I also don’t grant them that. Why is that? Because the Realized One’s knowledge of the great analysis of deeds is otherwise.
(emphasis added, also numbering in [square brackets])Now, Ānanda, take the case of the person here who refrained from killing living creatures … and had right view, and who is reborn in hell. They must have done a bad deed to be experienced as painful either previously or later, or else at the time of death they undertook wrong view. And that’s why, when their body breaks up, after death, they’re reborn in a place of loss, a bad place, the underworld, hell. But anyone here who refrains from killing living creatures … and has right view experiences the result of that in the present life, or in the next life, or in some subsequent period. So, Ānanda, there are deeds that are ineffective and appear ineffective. There are deeds that are ineffective but appear effective. There are deeds that are effective and appear effective. And there are deeds that are effective but appear ineffective.”
That is what the Buddha said. Satisfied, Venerable Ānanda was happy with what the Buddha said.
There is your answer. The path to hell is paved with wicked actions driven by hellish intentions and either the non-reaching of right view or the forsaking of right view previously held.