'These' is correct for the pastries, but 'it' should be 'they' since 'they' refers to multiple pastries.
These cows should be kept in the shed. - Correct as is. 'These' correctly indicates multiple cows that are nearby.
That jacket is too tight. I don't need it. - Correct as is. 'That' correctly indicates a single jacket at a distance.
I will polish these silver candlesticks and place them on the dining table. - Correct as is. 'These' correctly indicates multiple candlesticks that are nearby.