score:2
It is possible to apply online for a Canadian visa from any country where you are present legally. Justification needs to be stated but it does not have to be the emergency or necessity kind.
Due to various travel restrictions and visa processing timelines during the Covid pandemic, doing this might be faster than applying in one's home country. But is it allowed?
Note that in general, most applications are processed online nowadays by central or delegated offices in Canada and around the world, not the consulates directly.
It might be faster if there is significant difficulty in obtaining a VAC appointment for biometrics collection in your home country; or a significant load of the visa office responsible for the region, the U.S. included (average 87 days at the moment of answer)
And for many countries that have significantly longer processing times, it is usually due to for example prevalence of fraud or complex cases, uncertainty regarding the authenticity of administrative or other documents issued in that country, which will not necessarily be alleviated just because you applied from elsewhere (but your ability to have been legally admitted to the U.S. is helpful).
I am currently living in or visiting a country that I am not a citizen of. Can I apply for a visitor visa at the local visa office?
If you are applying on paper we recommend that you apply for a visa from your home country. However, if you are legally admitted to the country you are currently in, you can apply at your nearest visa application centre (VAC). The VAC can help make sure your application is complete and that all proper documentation is included. You must state clearly on your application why you have not applied in your normal country of residence.
You can also apply for a visa online.
https://www.cic.gc.ca/english/helpcentre/answer.asp?qnum=1017&top=16