That’s a good question. Both Luke and Matthew provide narrative context attached to fairly definite historical circumstances, although moreso with Matthew who attaches the parable to multiple other data reported of the same scene by both Luke and Mark, including data which contextually shapes the meaning of the parable in question. Luke’s setting for the parable, on the other hand, comes in material unique to his account.
In the case of Luke’s report, Jesus gives this parable during one of His dinner meetings with Pharisees, specifically the dinner meeting where a man suffering from dropsy was present. (Luke 14:1-6) Then Jesus introduces the parable of the wedding guests by advising that when they are invited to a wedding they should not recline at the place of honor but should promote those in the least places forward–in fact, they would do better not to invite people for lunch or dinner from whom they might expect repayment, but should invite those who cannot repay, the poor, crippled lame and blind. (vv. 7-15) Then in response to someone’s benediction, “Blessed is everyone who shall eat bread in the kingdom of God!”, Jesus gives the parable of the wedding feast. (vv. 16-24) In Luke’s account, the only negative result for the insulting invited guests is that they won’t eat of the dinner (which they were refusing anyway); but they were only being insulting in their refusals, not rebelliously (and murderously) insulting to someone in rightful authority over them.
The appropriate question isn’t whether Luke understood the parable and its contexts, but whether he was accurately reporting an incident that historically happened. By the standard conventions of grading ancient authors (do they say they are trying to report real history and include genre markers indicating they’re serious about this and not just saying so for dramatic fiction flavoring; are they reasonably accurate where we have some ability to check them; etc.) Luke either earns a basic trust that he’s reporting accurately (or at least what he thinks is accurately), or he doesn’t in which case we have much worse problems than whether we should be trying to understand the meaning of this parable!
If Luke earns a general trust that he’s reporting accurately, however, then the question becomes whether we have definite and sufficient reasons to think he isn’t reporting a historical incident here in some way. (Perhaps adding details of one or another kind to an otherwise historical incident.) If we don’t have such reasons, and I for one don’t, then the reasonable provisional inference is that we should proceed with the data as he has reported it and evaluate the meaning in regard to the contextual details Luke provides.
(Which is all very bothersome, but that’s one reason why there’s forty hundred million scholars working on this collection of texts. )
So what does Luke report as the contextual coloring from Jesus for this parable? An emphasis on the intention of God to heal on the sabbath, including those things of God which have fallen into a pit (an emphasis He expects His servants to share, but which they notably don’t, for which they’re being rebuked); and a related emphasis on promoting up and honoring those in dishonor. After this comes the warning, although Jesus puts it very softly in this incident, that those who insultingly hold to their own high honor will be dishonored, while the man who represents God goes about honoring the dishonored. But the man who represents God (by prior context of what came before this parable) did seriously invite those other people, too!
Thus the parable functions like a typical Synoptic riddle: considering the circumstances, what should we expect God to do, sooner or later (but especially on God’s Great Sabbath to come), in regard to those people He seriously invited but who have stumbled into the pit? Should we expect God to mean that they will miss all future dinners and never be invited (or compelled to come in), or only that they are missing a particular dinner? A wedding feast dinner is no doubt important (although Jesus doesn’t include this detail yet, thus not in Luke’s report), thus especially insulting to refuse attendance for such blatantly insulting reasons, but someone who is married does have more than one dinner; Christ certainly assumes the Pharisees will have dinners after the one He’s currently attending! Otherwise there would be less than no point for Him to advise them to do better in regard to future dinners!–don’t keep behaving in ways which insult God and get you excluded from dinner with Him!
Do we have reasons to believe Matthew is generally incompetent at reporting history, and/or has no intention to do so? If so, we have much bigger problems than interpreting his version of the wedding feast parable (at GosMatt 22). Since I have no such reasons, the next question is whether we have reason to believe Matthew has created an unhistorical context here? If he has, then we should be asking whether he has understood the context (and whether he has the right to create interpretative context). If not, then it doesn’t matter much whether Matthew understands the context, because he and we are all dealing with the same historical data.
Matthew, much like Luke (despite one way of reading Luke’s prologue) has a definite tendency to move material around topically. Has he (or Luke) done so here?–has Matthew picked up a saying from Jesus, historical in itself, from one incident (such as Luke’s) and ported it over to this Temple scene because he thinks it fits thematically here?
Matthew is certainly including it in strong double-or-triple Synoptic material. The parable has thematic connections to what follows and came before, and so do the details of the parable unique to GosMatt compared to GosLuke’s version. That might mean Matthew (or his source or his tradition) thought it should go here and added details to spice up its contextual relevancy even further; but it might also mean Jesus thought He should tell the parable again in these circumstances with extra details to ramp up its contextual relevancy even further.
I don’t know that we have any way to be sure from historical analysis which is the case; but if it fits in such a way that Jesus might have said it here, and if Matthew has proven sufficiently fair and critical in presenting historical data (even if he likes to thematically shuffle things around), then I think we ought to operate in good historical faith (so to speak) and treat the material as though Christ chose the context not Matthew. Moreso depending on whether we think the arrangement of material (and thus its contextual connections) was inspired by God for details we can be sure had to have happened one or the other way but not both! (Such as the different order of the desert temptations reported by Matthew and Luke.)