Well, The Mandalorian takes place 5 years after Endor.
TFA takes place 30 years after Endor.
So the Imperial Remnant or a portion thereof has 25 years in which to continue to fight off and/or evade the New Republic, regroup, decamp to the Unknown Regions, revive, clone, or otherwise resurrect Emperor Palpatine, clone up a Snoke or two, kidnap several hundred thousand kids to raise as stormtroopers, train and equip a heavily armed and technologically advanced army, convert an entire planet into a star-eating hyperspace weapon of mass genocide, incite and thereafter tangle with a Resistance, all while squirreling away a giant, fully crewed fleet of Star Destroyers with Death Star-class Super Lasers mounted on them so amongst other things Palpatine can die again and be reborn inside his fetching young female descendant.
This being the same imperial army that got its ass kicked by spear-wielding dwarven teddy bears and a ragtag alliance of disgruntled citizens and lost two giant planet killing battle stations.
Got it.