How to set page-specific CSS classes on the page callback build array?
#attributes is the correct property, but the problem is that $build itself is not actually an render element (unless make it one), it's just a collection of render elements.

To make it an actual render element, you have to set the #type property to for example 'container'. That is nothing more than a div with attributes that contains other elements. See When should the &quot;container&quot; form element be used? and theme_container().

You can however not affect the mentioned content div, that is outside of your control. Adding a container will add a new div inside that one.