Unlike US green card, the Canadian permanent resident status can be maintained solely through meeting the physical presence requirements (NOT residency).
The requirement is, within the past 5 years, you need to be physically present in Canada for over 731 days (check the official IRCC website regarding maintenance of the Canadian permanent resident status). And a day, where you spend any time at all in Canada, counts.
canada.ca/en/immigration-refugees-citizenship/services/application/application-forms-guides/guide-5445-applying-permanent-resident-card-card-first-application-replacement-renewal-change-sex-designation.html#appendixA
You don't need to prove residency (such as bills, driver's license), though they'd definitively help if you have a borderline case, or if you cross the border daily, but merely that you are physically present in Canada for the requisite amount of time.
This is more flexible than the US green card requirement where you have to be continuously resident of the US.
Regarding H1B in US, it is possible to live in Canada, and then commute daily across the border to work in the US under H1B.
There are dozens if not hundreds of Canadian PRs in border cities like Fort Erie and Windsor doing this daily.
These people can keep working like this until they get Canadian citizenship, before moving to the US.
And it is all legal (because even the requirement for Canadian citizenship is solely based on physical presence).
Make sure you meticulously count the number of days in Canada. Keep a spreadsheet detailing your trips to the States (and other countries), and (at least in theory), you should be fine.