 Also, if they buy the currency it is pegged to, then the price of that currency will increase, causing the relative value of the currencies to be closer to the intended relative value (unless it overshoots...)

If the exchange rate drifts too far below the desired rate, the government buys its own currency in the market by selling its reserves.This places greater demand on the market and causes the local currency to become stronger, hopefully back to its intended value.The reserves they sell may be the currency it is pegged to, in which case the value of that currency will fall.