Divisions are only applied to an entity (e.g. a user) in the context of a role; they are not applied to roles directly. The screenshot you shared above allows division assignment because you're editing a specific entity's configuration. When you edit the role itself, there is no opportunity to assign divisions.
Additionally, you can use your browser's developer tools to inspect the requests that are made by the UI to see what API it's using to complete the actions in the UI. This will demonstrate which API endpoint to use and how to use it to accomplish the same behavior in your own app.