Formation of eastern boundary undercurrents via mesoscale eddy rectification