When switching modes, the active object visibility is used to determine
whether or not the mode can be entered. Whether or not this object is
null or not is dependent on the current mode. Object Mode uses the
underlying visibility, whereas other modes do not. When
`mode_compat_set` is used, the active object is switched to object mode,
causing `CTX_data_active_base` to be null.
To fix this immediate issue and prevent further refactors from
potentially reintroducing it, this commit makes a number of changes:
* Clarifies the `object::mode_compat_set` function docstring in
ED_object.hh
* Makes `object::mode_compat_set` the last operator check
* Uses `BKE_view_layer_base_find` instead of `CTX_data_active_base`
since both necessary parameters are already on-hand in the function.
Pull Request: https://projects.blender.org/blender/blender/pulls/141985