deus ex machina
formal
a way of ending a play or event that seems false and that involves problems being dealt with too easily.
Shakespeare produces a very unsatisfying deus ex machina in 'The Winter's Tale' when a statue of the queen comes to life.
Cambridge English Idioms Dictionary