This question needs some looking around. I'm just putting out my theory and this is what I think.
The two series Avengers Assemble (AA) and the older one Avengers:Earth's Mightiest Heroes (AEMH) might as well be linked. Although it is not shown in the latter, but in Avengers assemble S01 E08: Molecule Kid, when Hawkeye recollects their fight with Molecule man, the flashback shows everyone in the original costumes (which were used by the avengers in the AEMH series).
So, if we assume that the two series are linked, when Ultron is destroyed by Thor in S02 E21: Ultron Imperative of the AEMH, there could have been a chance that a small part of him was stored somewhere else. Later when Ultron found a backdoor in Arsenal (in AA S02 E13: Thanos triumphant), he got into it.
Some other links between AA and AEMH could be that in the AEMH series, Pym quits being Ant-man and passes the mantle to Lang. The AA directly introduces Scott Lang as their Ant-man.
And also, Black Panther, Captain Marvel, Vision each of these characters when appeared in the AA series, it's shown as if the original Avengers (Stark, Cap etc.) already knew them.
However, there are other contradictions that do not support this theory too. Like Falcon's, Jane Foster's role differed quite a lot in the two series.
I'd like to believe that these two series are related. Nevertheless, it might also be that Marvel is tinkering a lot so they may have missed some details.