Does a twig template know in which region it is?
No, it doesn't.

With render caching, it is even possible that the same template/thing is not rendered again and put into a different region (not directly a block, but for a example a rendered entity, in a view or so).

It's easy to do targetting in CSS based on a parent region class. I know there are some recommendations to avoid that, but that's not always possible, especially when working with a complex system like Drupal, where you don't have 100% control over the HTML output in every scenario.