Should a product manager know how to code?
As an ex-engineer, I'm inclined to say yes. As an entrepreneur and later a PM who's managed teams of developers, I'll say no.
But it can be helpful.
You don't work with code often as a PM, even as a Technical Product Manager. Your primary responsibility as a PM is to understand what the users want and bring people together to make it happen. But you're rarely the one actually building things, it's usually up to other teams (design, development, sales, marketing).
So, you don't need to know how to code, how to design, and how to sell. As in, you aren't expected to go and do it yourself. That said, knowing how all of these things work at least to some extent makes it so much easier to communicate and negotiate with the people in charge of doing them. Knowing the fundamentals of the design process and tools makes you more efficient in working with designers, and knowing the technical stuff makes you better at talking to engineers.
In my last job, I was not expected to write Node.js and React code and troubleshoot AWS and Jenkins. However, knowing how to do this allowed me to perform time-sensitive tasks myself more than once without having to wait for an engineer to become available. It might not have been part of my PM responsibilities, but it had to be done fast, and I could get my hands dirty and just do it.
There are drawbacks to being a technical PM, too.
We all have limited time and attention capacity no matter what our role is. You can't be an expert in everything. So the fact that you've spent time learning how to code means you haven't spent it on something else that might be more important to you as a PM, such as honing your management or strategic thinking skills. And in my opinion, your soft skills matter a lot more than your technical skills when it comes to product management in general.
The other drawback is that having technical skills as a PM can make you more willing to focus on things where these skills are required, e.g. discussing the implementation details with the engineers and arguing about the technology instead of investing this time into higher-value tasks like researching the market and user needs and prioritizing product features.
In my early entrepreneurship days, shortly after I've put together my first engineering team and stopped writing code myself, I was prone to spending a good chunk of my time doing code reviews. It was a major waste of my time that I should've put to better use researching the market, and it also drove my developers crazy because my feedback wasn't exactly helpful. Fortunately, I grew out of this habit.
To wrap this up, you're not required to know how to code as a PM. If you have this skill already it can be helpful, but be careful and remember that you're primarily a manager, not an engineer. And if you don't know how to code and want to improve your product management skills, don't bother learning a programming language. Leave it to R&D and invest your time into improving the more essential PM skills.