How to add a class attribute to a block?
Have you tried to just set #attributes on the render array returned by our block plugin? 

$build['#attributes']['class'][] = 'my-nice-block';


Looking at BlockViewBuilder::preRender(), that should work.