That does work. I moved my entire FF install when my old machine died unexpectedly and by moving all of its folders to the right places on the new machine, it continued like there had been no interruption...all passwords, history, prefs, everything.
It’s kind of a convenient “feature” up until you start thinking about the implications. Of course most convenient features are like that, making it easier on legit users always makes it easier for bad guys, and making it harder on bad guys always make it harder on legit users.