Kustom, 67 bytes
This makes use of the fact that an undefined global variable works as empty string. The extra byte is for the name of the defined global variable.
$fl(1,tc(len,gv(n)),"i+1","tc(lpad,gv(x),i,tc(cut,gv(n),i-1,1))")$ Sort of ungolfed:
$fl( 1, tc(len, gv(input)), "i + 1", "tc( lpad, gv(undefined), i, tc( cut, gv(input), i - 1, 1 ) )" )$