Access Fast User Switching from a script in Big Sur
User.menu along with other menu items were incorporated into Control Center in Big Sur, which removed the menu item package from Menu Extras. Gone with it is CGSession.
There does not appear to be an immediate replacement, and while workarounds for some of its other functionality have been developed, nothing for fast user switching yet.