Is it still possible to use a custom attribute for a form (e.g. $form['#foo'])?
See FormCache::setCache(). The whole $form is put in the cache, anything that's in there is stored and fetched again.

That said, I would definitely advise against using it. The recommended and standard way to store something is $form_state->get()/set().

Also be aware that while this still works when the form is cached, Drupal 8 only caches form/form_state once an actual form submission happens. Usually that means only for ajax requests and in case of form validation errors (although I don't 100% know how it behaves then).

That means you can not put something in $form['#whatever'] or $form_state->set('whatever, ...) on the first form build and expect it to stay there.