The “Last Gospel” at the end of Mass was originally a “sacristy devotion” that got added to the end of the Mass by Pope Pius V in the late 1500s. Originally there were different Last Gospels; at some point they started using the same one all the time. It was removed as part of the 1950s liturgical reforms. There doesn’t seem to be a clear consensus on why it was removed - some say it was just to make the Mass shorter, others say it was an attempt to make Mass more appealing to Protestants, still others say that the “Last Gospel” didn’t appear in a lot of the old rites that the reforms were trying to imitate.
As for the St. Michael prayer at end of Mass (after Mass), that along wih the Hail Holy Queen and some other prayers are the “Leonine Prayers” that Pope Leo XIII directed everyone to say. The intention of saying the prayer varied over time (originally they were for the sovereignty of the Holy See, later for the conversion of Russia), and in 1964 the Vatican simply released a directive saying “The Leonine Prayers are suppressed.” There has been much speculation over whether that was done because the Pope felt the Devil had been vanquished and there was no reason to continue with the prayers, or whether it was done because these prayers really weren’t part of the Mass, etc. In the last few years I’ve noticed that a number of priests saying OF Masses will work the St. Michael Prayer in, either at the end or sometimes after Holy Communion or at homily time, etc. Technically it’s only supposed to be done after Mass is ended as one isn’t supposed to add prayers to the Mass, but I don’t think most people know or care enough to complain.