Consular immunity in America would have not granted the Saudis much cover
It would have been a poor choice of a place to do this
Im not sure why they didnt assasinate him in public perhaps if he was such a thorn to them
This has likely terminated the Crown Prince aspirations which in my view is not a good turn
Had the Crown Prince wanted to get rid of Khashoggi there are any number of discreet ways to do it. Assassinating him inside a Saudi embassy is definitely not one of them.
In fact, killing him in the embassy was guaranteed to generate an international incident and deliver a major setback to MbS. Which I suspect was the intended goal, since MbS is not a fool and would have known better.
My suspicion is that this was ordered by someone else in the Saudi royal family whose intention is to discredit MbS and if possible replace him.