How can a thermometer ever show the actual temperature of an object if the object loses heat to the thermometer?
I'll start by mentioning that there's no such thing as an exact measurement—there is always some measurement error.  The only observations that can be numerically exact are counted numbers of discrete objects (e.g., the number of electrons in a neutral carbon atom is exactly 6).  And I say &quot;can be&quot;, because if the numbers are sufficient large, even with counted numbers there can be errors (we see this with vote counting).
Having said that, your idea is correct—if the heat capacity of the temperature probe is significant relative to that of the object being measured, then the measurement can significantly change the temperature of your object.
This is a particular concern when measuring small objects.  For such applications, researchers can employ (as Jon Custer mentioned in his comment) non-contact thermometry.  See, for instance:
https://www.omega.co.uk/temperature/z/noncontacttm.html