I think you've got two different things going on here. You want to learn, and I am assuming you mean 'learn to develop games'.
If so, you are going to hinder yourself by trying to avoid libraries. There's two probable scenarios I can make up:
- You'll start off with most of it done for you.
- You actually will finish games much faster. You may not care about them, but you are so much more likely to keep going if you've got something done.
You'll therefore learn at a high level. You will know how to organise your collision code and your rendering code, even if you aren't organising the vertex buffers.
You'll become more used to what the functions and classes do under the hood, either by learning about them or generally by practice.
- Now you can go back and write your own collision testing and OpenGL engine and know what you're doing - since you understand, it will work and you will learn.
Not using libraries (jumping in)
You'll have little idea of what you're actually doing.
You can learn from the examples, but it's very likely you'll just go 'oh, that works but I don't know why'.
You will not learn to structure and fit everything together so easily, since your focus is building each component separately.
Overall, you are likely to lose motivation and give up..or at least act slower than the other method.
An analogy is collecting and painting model figures. Using libraries is equivalent to getting mostly done figurines for you, or ones with few pieces and learning to paint them. Not using libraries is like trying to sculpt your own from a reference.
As for libraries (you say 2D), I would check out SDL which is older, mature, has a wide userbase but written in C, or SFML which is newer and as such less mature, but uses OpenGL (hardware acceleration) and is, in my opinion, better structured in terms of API.