Notice that you original solution was simplified and used in here. Simplified original solution is in B3
:
=REGEXREPLACE(
CONCATENATE(
ArrayFormula(
REPT(
INT(SPLIT(A2, ",") / Months) & ",",
Months - MOD(SPLIT(A2, ","), Months)
)
& REPT(
INT(SPLIT(A2, ",") / Months) 1 & ",",
MOD(SPLIT(A2, ","), Months)
)
)
),
",$",
)