You shared to few details, so the answer would be general:
When you login, you rely on web or api guard to retrieve user details, including database in your case.
At the same time jobs are running without authentication in background. Job just don't have authenticated user and his details.
I don't know your business logic, so hard to say which to choose
At glance, I would pass database name directly to job:
class MyCustomJob
{
public function __construct(..., protected string $dbName = 'defaultDB') {}
/** other logic */
PS:
php artisan queue:all Xcompany
is something custom I guess, so there could be also some problems