You need to specify it in the command, e.g.
drush -l https://my-site.org upgradedb
For upgradedb it shouldn't be too important, but for example for a command that sends out emails with links it would have http://default/ in them instead of your real site.
Here's what I ended up doing. It feels a bit weird, but so far it seems to do the trick.
Having created the fields I need for the two contacts, and ensuring that buyer is contact 1 (because the contribution appears to only work for contact 1), I can then specify a membership that will be applied to contact 2.
Even though I've set a minimum price for the ...
OK. Looks like I am not the only one with this issue.
A newer version of scssphp (v.1.7) appears to be the culprit: https://lab.civicrm.org/dev/drupal/-/issues/164#note_65206
Patch applied to CiviCRM 5.42
The tl;dr on lab.civicrm.org: If you're affected by this and need an immediate fix, run composer require' ...