I doubt there are a lot of places where you're replacing that scenario with public transit.
I think my last commuter rail is around 10:30pm but I'd have little confidence that I could get a taxi/Uber from the train station; it's not that far but certainly not safely walkable especially late at night.
Picking some random village I've never been to, from Copenhagen to Uggeløse (population around 2000) takes 65 minutes, the last connection to the bus requires leaving Copenhagen at 23:16.
Picking some other village that's on a railway line (Veksø, population 1800), the trains run all night every 30 minutes on Friday and Saturday nights. On other days the last train is at 00:30-ish.
The original claim was from a city to a town, which is easier than either of these examples.
There's a class of "ban cars" city people who cannot fathom this.
Your preference for where and how to live or inconsequential to their goal of removing cars from earth.
Note that this solution would also constrain me to a life of teetotal evenings enviously watching my friends share a few pints.
You could say that it's flawed to live in the countryside and/or have distant friends but my point is that public transportation on fixed lines will never reach every place at every time, especially where people are spread thinly. Taxis can do that, self driving cars can maybe drive their cost down. I could do without my own car if I could summon a public transport car at a whim anywhere I am to go anywhere I want.