Please could you try these two:
Development mode, using different env to set database:
SKIP_DB_AND_REDIS=1 DISCOURSE_DEV_DB=‘nonexistent’ bin/rails runner “puts ‘booted successfully’”
In test mode, with plugins loaded:
LOAD_PLUGINS=1 RAILS_ENV=test SKIP_DB_AND_REDIS=1 RAILS_DB=‘nonexistent’ bin/rails runner “puts ‘booted successfully’”