I don't change the origin anywhere.
I followed your advice and drew a red rectangle around the text, and took some screenshots to demonstrate it.
Ignore the white background, it's because I took a screenshot and cut out the relevant part (teal rectangle + black text).
This is right after I've created the rect and text:
The position hasn't been adjusted yet, but you can already see that the rect's right bounds are bigger than the actual font.
This is when I enter the first letter:
You can see for some reason the rect stays at its original position even though I've updated it.
This is when I enter another letter:
The rect finally moves, but its and the text's positions do not match.
This is after entering some more stuff:
Just like in the picture above, the bounding box is out of place.
I tried using different fonts, but they all have the problem of having weird bounding boxes...
Edit:
When I just change the string but not the text's position, the bounding box is like this:
It still has this gap on the right, but besides that it's perfect.