Thanks for the feedback! It's not random: after a failed boss the army trains for a few waves, then the boss comes back on its own. It also comes back early as soon as your army is about 25% stronger, which is why it showed up after your upgrades. The latest version adds a "Challenge the boss" button so you can call it back yourself. I'm looking into a way to hold it back too.