You obviously don't understand the dogma of Infallibility. There are many more dogmas and doctrines than the two Marian ones you are referring to. The infallible dogma of Infallibility itself was a decree of the First Vatican Council. 
The pope didn't suddenly become infallible in 1870, he always had been from Peter onwards. Dogmatic Decrees of General Councils on matters of Faith and Morals become infallible when ratified by the pope. The Mass and the Sacraments come under the category of Faith.