The obstacles, from what I know...
Visa--if you don't have a japan-based employer, how are you going to get a visa? It's illegal to work on a tourist visa, if you come as a student (for that visa) you need to get permission to work, and working for a foreign company may not be included in the permission given. If you got married quickly, you'd then have to sort out getting a spouse visa, which would include proving that the marriage was legit and not a visa tool. If you get a working visa, the job for that will be full time, and, like a student visa, you'd need to get permission (and your employer may not be cool with that).
Working for a foreign company would almost certainly need to be as a contractor. If you are an employee, then that company, by employing someone in japan, becomes liable/responsible for business taxes here--they have to either establish a legal presence (registration, taxes, etc), or use what is called an EoR, employer of record. That's a company here that acts on their behalf, employing you, and also doing the background necessities like pension, healthcare, tax reporting, an so on.
Japan does not have a visa/status of residence like some other countries around the world. Those other countries do accept/encourage digital nomads, or retirees, usually those folks supply some proof of assets or income, and those other countries allow them to stay and work. Not in japan.