Sounds fine to me. It's not like you're leaving Ontario forever - will you continue to have a lease and strong connections to Ontario aside from your employment?
Per CIC:
To keep your permanent resident status, you must have been in Canada for at least 730 days during the last five years. These 730 days don’t need to be continuous. Some of your time abroad may count towards the 730 days. See can my time abroad count towards my permanent resident status?
Yep I wouldn't worry about it - you have plenty of evidence to demonstrate that you're keeping strong ties to Ontario and that's the thing that matters most. The only consequence is that your path to citizenship may be delayed by 4 months (I don't know how IRCC looks at remote work) as you're working outside Canada of your own volition rather than for a Canadian company who has posted you to your home/another country. You're allowed to go home for personal reasons!
Your concern about keeping PR will only be a concern if you're leaving Ontario to permanently go to another province in which case they may ask questions about whether you had a genuine intention to reside in Ontario in the first place.