I consulted a practitioner (in Taiwan, so I'm not exactly sure how to describe her.) She directed me to do the following: stand on tiptoe closely against a flat wall where the ceiling is higher than I can reach on tiptoe. Keep forehead against the wall. Reach upwards, keeping the part of forearms nearest the wrist against the wall. Inhale and exhale, relaxing muscles and stretching to reach further and further upwards with fingertips. Do this for at least 30-45 seconds, relax, repeat a few times daily.
I am not good at sticking to the program but it does seem to be helping
https://youtu.be/RXhyx-vVG_Y?si=TiQVGASxnIRPQDTl
Do it for 30s, maybe 3 times a day, you can also move your feet forward for more challenge.
Speaking out of my ass: I'd guess your posterior neck muscles grow weak due to the unnatural posture and your frontal/side muscles overpower them. Eitherways, it works.
1. You need both stretches and muscle strengthening exercises.
2. Ergonomics while working matter, things like putting your monitor higher will help a lot compared to hunching over a laptop.
3. Consult a physiotherapist. If money is tight then just do a single visit and ask him/her to diagnose and then give you some tailored exercises. You can then do those and might not have to go back.
My personal recommendation is to look into the short exercise book "Treat Your Own Neck" by the late physical therapist Robin McKenzie.