I think your idea to change status before filing the I-526 petition is good. You can file the I-526 under a nonimmigrant status (like the J2) and indicate you wish to adjust status upon approval (filing the I-485 application with USCIS). If there is some delay and your nonimmigrant status expires, you can still go through consular processing at a U.S. consulate in your home country.
You can file an EB-5 I-526 petition whether you are in or outside the U.S.