Habilitation in Germany as a nonresident
I think you have a few misconceptions about what a habilitation is.

To answer your first question: Yes, you can apply for a habilitation as an external candidate; just like a doctorate, this procedure is formally totally independent from your employment status. (But just like for a doctorate, it is much harder to get them to take you on if you are an external candidate.)

For your second and third question: This is very much field (and university) dependent; some will accept a stapled thesis (i.e., just submitting a list of published papers written after your doctorate), others require you to actually write a book. In any case, it is irrelevant where you wrote these.

However, the main part of the habilitation is to obtain the venia docendi -- the right to teach at this specific university. This means:


You must demonstrate to the committee your ability to teach at university level; again, it wildly differs how you need to do so -- some places will accept student evaluations of classes you taught elsewhere, others require you to give an example lecture in front of the full faculty (which, needless to say, can be rather a tough gauntlet). The easiest way is to already have a habilitation at a different university. (This is called Umhabilitieren.)
More importantly, if you are not interested to teach at this university (and even more importantly, they are not interested to have you teach), the university will not confer a habilitation on you. (To put it bluntly, universities take a dim view of "degree collectors" who are only in it for the title.)


So, no, a crucial part of the habilitation can not be done remotely.

Since you wrote you are also interested in a full professor position in Germany: You are correct that a habilitation is a formal requirement for obtaining a full professor position is Germany, but the hiring committee can consider other accomplishments as equivalent. The most frequent one now is a positive evaluation as a junior professor, but another possibility is a tenured position at a university in your home country. In any case, your accomplishments in research (and getting grants) will be a much more critical part of getting a position.