What is the right way to force a session start?
Okay, found the answer from this change record: https://www.drupal.org/node/2228871

The session can be force-started like this:

// Force session start if we don't already have a session.
$session = \Drupal::service('session');
if (!$session-&gt;isStarted()) {
  $session-&gt;migrate();
}