yeah, not really re: the tax thing. I'd suggest taking that up with an accountant, or better yet an attorney specializing in international taxation - I am none of these. This is based on my experiences moving from the US to Canada, and further research I've done while traveling.
Work is considered performed where you were physically when the work was done. This work requires a work visa (or citizenship), whether for Canada or for said tropical paradise, otherwise you're subject to deportation. Lying about the purpose of your trip to gain unlawful entry is a whole other matter. Compensation you were provided for the work you did is then taxed by the relevant authorities where you were physically when performing the work. This is why US companies are very careful to tell employees never to work when on vacation because if you did they'd have a lot of paperwork to fill in.
If you're suggesting you can be a total non-resident of both countries by alternating between the two or splitting your time, luckily the tax authorities have thought of this too, I suggest you look up the definition of a Deemed Resident. Effectively, you are deemed a resident of the country to which you have the strongest connection. Or, you can be dual-status resident where you're a part year resident of one country and a part-year resident of another. Worst case they'll both deem you a resident and full on double-tax you if there's no treaty - but make no mistake you will pay taxes. Check out "What are residential ties?" [1] in the CRA handbook.
Now, I'd love to be wrong of course.
What I do know is that even if you're on vacation in the US, let's say on a B-2, it's a grey area to even contribute to open source projects. The US doesn't require that what you're doing be paid to be considered 'work'.
[1] https://www.canada.ca/en/revenue-agency/services/forms-publi...