The second generation Apple Pencil can only be charged using the iPad’s magnetic dock - intended to specifically charge the Pencil. The Magic Keyboard cannot charge the Pencil.
The Pencil will not be overcharged - in fact, you would be best advised to dock the Pencil with your iPad whenever it is not being actively used. Keeping the Pencil docked with the host iPad ensures that the Pencil is optimally charged - and will protect the Pencil from damage.
The tiny internal pencil battery is vulnerable to damage if not regularly charged. Setting aside an unused pencil is a recipe for premature battery failure.
Charge your Apple Pencil and check the battery – Apple Support