I don’t think this is a bug, although you can certainly question the design decision.
If you use a mouse to open the dropdown (i.e., by clicking), the search box is not focused. I believe the Select2 developer assumed that you would, in most cases, use the mouse to select the item(s) from the dropdown.
Conversely, if you use the keyboard to open the dropdown (i.e., by focusing on the control and pressing Enter or Alt+DownArrow), then the search box is focused, probably under the assumption that it will be easier for a keyboard user to search for the item(s) they want to select, rather than navigating through the results with the Up/DownArrow and PageUp/Down keys).
If you want to always ensure the search box is focused when the dropdown opens, you can attach an event handler for the
select2:open event. In the event handler, set focus on the search field with code like