At the risk of this question being closed for being too vague, maybe you need a starting point?
If you want to try your hand at writing a plugin, the first thing I would do is read up on the OAUTH protocol since that's what these services typically use to authenticate. For example, you probably want to handle this server-side so Facebook has some examples on how to do that.
Once you get a handle on that, you'd want to figure out how Craft/Yii handle authentication so you can hook into it, basically "bypassing" the built-in auth system if a user wants to login via a 3rd party provider.
There's way more too it than that and this is probably one of those use cases that sounds simple in theory but rolling your own auth solution definitely is probably not worth your time.
However it can be nice to know how these things work under the hood. (I personally don't want to be responsible for making sure it doesn't break when newer versions of Craft are released or when Facebook/Google/Apple decides to change it up.)
In that case, you can study the code of either Socializer or Social to see how they work. I would also recommend CraftQuest as a resource to learn more about Craft CMS dev.