Setting body ID from includes does not work
So Twig has a particular processing order for things like variables, includes, extends and all that sort of stuff. Basically, you can't set a variable in an included template and then use that in an extended template.

Here's a great article that goes into this topic in a little more depth: https://nystudio107.com/blog/twig-processing-order-and-scope - I'd highly recommend you give it a read.