I don't generally understand this train of thought. For employees that are full-time exempt (And most are), as long as you work a day, you are paid for 8 hours of work.
Whether your commute takes 3 hours or 3 minutes, you are paid the exact same because you can't work an extra hour instead of commuting for that $77.
Others folks that are on H-1Bs can't even work on side-hustles because of immigration law so what are they really missing out on?
That's just a yardstick for how much it personally sucks (econ: "disutility") for you to go without that extra hour, estimated from your current pay. You could come up with a different value by deriving it a different way[1], but somehow you have to put a value on the time lost for purposes of comparison.
The existence of this opportunity cost doesn't require that you literally be able to put in an extra hour for extra pay.
[1] For example, you could go based on "how much would I pay for an extra hour to spend doing XYZ?"
I do the same calculations simply to figure out if something is worth it.
For instance, laundry. I hate laundry. I could walk 100 steps to the laundromat, pay ~$5 to wash it. Or I could pay someone $15 to walk up to my door, take my laundry, wash it, fold it and return it to my door.
Ehhh... not that hard of a choice. The pain is worth $10.
I used to commute 1.5 hours every day and it was so incredibly painful, so I shopped around and found a cheap(-ish) place close to my work. My life is so much better now and I am much happier.
Looking at your pay per hour is just a decent yardstick for when you should trade off time vs money. No need to find an outside job for the yardstick to be applicable.
Eg should you order groceries online, or go to the shop, or plant vegetables in your own garden? It's all a matter of time and money, and also hassle vs enjoyment---since some people dread going grocery shopping, and some people enjoy gardening.
As a general yard stick of how you implicitely value your time:
$4k / 52h <= $77
Now, your current place probably costs money too, and your commute won't be cut to zero. You can plug in the numbers yourself:
($4k - current rent) / (52h - commute from apartment in SF) =: implicit value of one of your hours.
I hope you are making more than 77 dollar an hour as a programmer (?) in SF.
(Yes, I know, taxes complicate the picture. But only by at most a multiplier of 2.)