Individual microgrids can improve the reliability of power systems during extreme events, and networked microgrids can further improve efficiency through resource sharing and increase the resilience of critical end-use loads. However, networked microgrid operations can be subject to large transients due to switching and end-use loads, which can cause dynamic instability and lead to system collapse. These transients are especially prevalent in microgrids with high penetrations of grid-following inverter-connected renewable energy resources, which do not provide the system inertia or fast frequency response needed to mitigate the transients. One potential mitigation is to engage the existing generator controls to reduce system voltage in response to a frequency deviation, thereby reducing load and improving primary frequency response. This study investigates the use of a reinforcement-learning-based controller trained over several switching transient scenarios to modify generator controls during large frequency deviations. Compared to previously used proportional-integral controllers, the proposed controller can improve primary frequency response while adapting to changes in system topologies and conditions.