In order for a metal to protect another metal it must have a lower galvanic rating. Magnesium is 1, zinc is 3, Aluminum is 7, Mild steel is 14, SS is 21, Copper/Bronze 27.
The difference between Magnesium and Zinc is not that great, so it better to make sure the zinc is high grade and the zinc is clean of the white oxide coating. Aluminum is used to protect high rated metals when zinc is not practical or going to fast. However its better to find and correct the reason why.
Lastly two metal of large different galvanic rates should not be combine/connected to each other as the less rate will be sacrificed to the higher. In many application aluminum is used as the to protect higher rated metals.