There is a famous שיטת Rashi that the Matzas mitzva needs to be baked erev Pesach after חצות, otherwise you are not יוצא. Rashi gets this from the Gemara on Pesachim 120b where Rava has a היקש between מצה and קרבן פסח, that the זמן of eating מצה is the same as the זמן of eating קרבן פסח. Rashi understands that the היקש would likewise apply to the preparations, just like the קרבן פסח has to be prepared on erev Pesach after חצות, so too does the מצה. This is quoted as a יש אומרים in Shulchan Aruch. The Gra disagrees, one of his proofs is the following. What happens when erev Pesach is on Shabbos like this year? קרבן פסח is דוחה Shabbos and is therefore brought on Shabbos afternoon, however baking מצה is not דוחה Shabbos and therefore cannot be done on Shabbos afternoon. If so, how is anyone יוצא the mitzva of מצה, the מצה was not prepared in the זמן of the קרבן פסח? In truth, those rishonim who hold like Rashi say that when erev pesach is Shabbos, you bake the מצה on the seder night. However, the Gra's question stil holds. If the מצה needs to be baked in the זמן of the קרבן פסח, the seder night is too late, you cannot bring the קרבן פסח at that time.
A number of later acharonim answer as follows. The Gemara earlier states that the קרבן פסח is brought on Shabbos (and not that night after Shabbos) because it is זמנו קבוע. Rashi explains because there is a general din that korbanos cannot be brought at night. The acharonim ask, why didn't Rashi simply answer because the Torah says that the קרבן פסח needs to be brought on the 14th of Nisan and that night is already the 15th? They answer as follows. In halacha day follows night. However, by קרבנות the din is that night follows day. Therefore they say as follows. Although the seder night is the 15th in the calendar, with regards to קרבנות it is still the 14th as night follows day. Therefore, Rashi can't answer that the seder night is too late because that night is considered the 14th for קרבנות so Rashi needs to answer that קרבנות in general cannot be brought at night.
Based on this, we can answer the Gra's question as well. From the perspective of the קרבן פסח the night of the 15th is still the זמן, there is just a technical problem that you can't bring קרבנות at night, but from the pure קרבן פסח perspective it is the זמן and therefore you can bake the מצה that night. The היקש between מצה and קרבן פסח only relates to those special dinim of קרבן פסח, not to the regular dinim of קרבנות. Therefore from that perspective the seder night is still considered to be the זמן of the קרבן פסח and therefore you can bake the מצה then.
Some rishonim have a different version of Rashi. They understand that according to Rashi you need to bake the מצה on erev Pesach but even in the morning. This is clearly not connected to קרבן פסח as the קרבן פסח cannot be brought in the morning. The question is if so, why do you need to bake the מצה on erev Pesach?
RYBS explained as follows. The Yerushalmi has a din that it is prohibited to eat מצה on erev Pesach. The Ramban explains this as follows (why is the prohibition limited to erev Pesach). מצה is defined as being not חמץ. Without חמץ there can be no מצה. Before erev Pesach there is no halachic significance to חמץ, it doesn't really exist, therefore there can be no issur to eat מצה as if there is no חמץ there is no מצה. On erev Pesach when the mitzva of תשביתו destroying חמץ starts, then you can have מצה and therefore there is an issur to eat מצה.
Based on this RYBS explained Rashi. We know that מצת מצוה needs to be made לשמה. Rashi holds like this Ramban, that מצה is defined as being not חמץ and that without חמץ there can be no מצה. Therefore, before erev Pesach you cannot bake מצת מצוה because it can't be made לשמה as there is no שם מצה yet. Only on erev Pesach where there is halachic significance to חמץ can there be מצה made לשמה. Therefore Rashi says that the מצה needs to be baked on erev Pesach, even in the morning, to create the לשמה of מצת מצוה, and מצה baked earlier is no good because it lacks לשמה.
This also explains why they would bake the מצה on the seder night if erev Pesach was Shabbos.