The main issue with the posture images you included (shown again below) is that both positions represent extreme positions and both are likely problematic, despite one being labeled as correct. The image on the left has put the back into hyper flexion, over-recruited the lower abs and tilted the pelvis backwards, this position will likely cause breathing and back issues. The image on the right has contorted the upper back, splaying the rib cage open and turned off recruitment of the lower abs. The contorted rib cage will likely impact breathing as well.
The one thing that image on the right got correct, is that your pelvis should be titled slightly forward. Ideally, you want the pelvis tilted slightly forward, with a smooth transition into a flattened back. A good example of forward pelvis tilt with a flattened back is the blue rider pictured in the next picture featured). His pelvis is tilted forward (similar to the "correct (but not really correct)" image above, but he also has some mid back curvature with a smooth transition from pelvis to mid back. This makes it easier to engage your core muscles better to support your upper body. Try sitting in a chair, bending forward a bit (while keeping your feet off the ground) and see how easy or hard it is to support your upper body when rolling the top of your hips forward or backwards. Flattening the upper back is also very important for breathing which we touch on further below.
This type of rider position is often seen in professional riders, and is explained in more detail in "Bike Fit" by Phil Burt (lead physiotherapist for British Cycling and a consultant physio for Team Sky):
Posture is the maintenance of a certain body position and requires appropriate joint mobility, joint/muscle coordination and muscular endurance. Limits in any of these elements can result in postural irregularities. Good posture on the bike required good flexibility through the hamstrings and the glutei muscles: this allows the pelvis to roll forward, keeping the back in a straight position while reaching the handlebars.
One major factor limiting the back's ability to remain relatively straight while on a bicycle is thoracic immobility: lack of movement in the middle of the spine normally results in the spine flexing too much. Excessive spinal flexion while on a bicycle will limit breathing and compromise your ability to stability your spine for torque production to the pedals.
-Phil Burt, Bike Fit
A second key consideration in cycling is breathing, which can be impacted by posture:
There are both anatomical and bicycle limiters to ventilation. An example of an anatomical limiter to ventilation would be being too flexed through the thoracic spine (that is, bent forward), not allowing the ribcage to expand sufficiently.
-Phil Burt, Bike Fit
In both posture positions in the top photo, neither have a flat back, which will impact the effectiveness of breathing. In the photo on the left, the ribcage is flexed through the thoracic region as described in the quote above. In the second image on the right the thoracic region is again being flexed, but in the opposite direction. This will again impact the efficiency of ventilation compared to a flattened back.
Not only is effective ventilation important, but inefficient ventilation mechanics can cause secondary breathing muscles to be over worked which can lead to pain. (Breathing is incredibly important, your body will find a way to draw breath, even through poor mechanics if necessary, exhausting muscle not "designed" for such extended usage scenarios):
Ventilation for the endurance athlete is most effectively performed through diaphragmatic breathing, in which contraction and relaxation of the diaphragm pulls and pushes air from the lungs. Secondary muscles of ventilation include the inter-costals (between the ribs), the abdominal musculature, the trapezius, the levator scapulae and the scalenes. If diaphragmatic breathing is compromised these secondary muscles can become chronically overworked leading to myofascial type pain (i.e., pain between the muscle and the muscle covering). This is often seen in the upper neck and shoulder muscles.
-Phil Burt, Bike Fit
No there is no way to know whether posture and ventilation mechanics are responsible for the OP's neck pain, but I think both of the posture pictured in the top posture photos could lead to such problems.
Endurance position, same principle
Finally, race positions are obviously not the best position for everyone! Here is another example of pelvis titled forward with a flat back, but in a more sustainable "endurance" type position which have a higher front end stack and a more upright position:
The rider also has a good elbow bend, straight wrists, and relaxed shoulders. Overall, a great position.