Although it was inferior to the P-47 and P-51 it seems that it was good enough to continue production at the end of 1944...
It wasn't
by 1942 the P-40 was indeed obsolete. The US Senate hammered this message home in the form of the Truman Committee. Curtiss-Wright were heavily criticised for poor management policies and inferior products, directly accused of 'riding the gravy train' wrt to contracts awarded off the back of their close relationship with the military, taking $4.7 billion out of a defense (US sp) total of $105 billion for the period 01Jun40 through to 01Mar43.
The Airplane Division attracted the heaviest criticism and two products in particular, the P-40 and the SB2C. Curtiss-Wright AND the Army shared the blame for the continuance of the P-40 when it was so clearly obsolete in the face of more advanced designs like the P-47 and P-51. The Army was condemned for failing to recognise the importance of the newer designs and not ordering them into production sooner. Curtiss-Wright themselves actually attracted some credit for making 'a number of modifications' but the wider view of the report attacked the over-zealous sales pitch, by the company, of the P-40.
Balancing this, the Truman Committee failed to recognise that P-47 and P-51 production facilities were not yet up to speed in 1943 in order to maintain a constant flow of hardware to the USAAF combat units. This lack of volume had to be compensated with continued P-40 production and this is where the Truman Committee failed to recognise the delicate balance between quality and quantity. The Army's turn to take some credit, they tried to speed up the process in early 1942 by directing the Airplane Division to end P-40 production and take on P-47 production. This did not go well. There were a multitude of QC issues and only around 300 units had been turned out by the end of the same year. The problem was compounded by the need for aircraft for North Africa and Russia and the P-47 lines were abandoned while Curtiss-Wright returned to P-40 production.
The P-40 was not good enough after 1942, it simply had the good fortune to be around in terms of aircraft and tooling to make more aircraft.
Looking at it by the numbers, the last of the line, the P-40N was capable of 340mph at 15,000ft. Its contemporary, the Nakajima Ki-84 approached 400mph 5,000ft overhead of the N. The Bf109K was capable of 450mph at roughly the same height as the Ki-84. All three aircraft were in production in 1944 and while Curtiss-Wright managed to sell 6,000+ P-40Ns, there appears to be little in the way of confirmation as to how many actually saw combat.
If the P-40N was tasked to intercept the latest bomber, the B-29, it would not be able to fly high enough by some considerable margin and even if it could, it would barely be able to catch it, assuming best speed altitude at the same height as the B-29.