I'm amused to see GitHub thought of as self-publishing. It is nothing of the kind. It's someone else's platform granting you an instantly revocable right to use their facilities, no - or just a few thousand - strings attached.
In principle no different from Facebook and Twitter and all the other shoddy complimentary crap.
This seems to be a silly distinction because I doubt you will find many sites which pass your bar for being self-published. Unless you bought your own hardware, host it on land you own, connect to the internet via your ISP, and call it something under your TLD there are still a lot of people who can revoke your access to the internet arbitrarily and have terms of service. Nobody is an island.
With GitHub you can use your own domain and have full access to the code. GitHub revokes or kicks you off? Just upload the code somewhere else and point your domain there. That's not the same situation as publishing on Medium.
It's different in that I am the customer, I literally give them money to host my stuff. They can of course stop hosting my stuff at any time, but then I will also stop giving them money.
I'm not 100% sure since I'm a developer and not an entrepreneur, but I think they prefer to receive money rather than not receive money.