Hard to tell what is happening without seeing the actual tilemap settings. If the tile is stretched vertically then I would assume the region settings for the tile are wrong. If they are sometimes wrong and sometimes correct, then possibly you are changing these settings in your code - although that is unlikely to happen accidentally for a tilemap.
If you post the scene you use to generate the tilemap, it would be easier to debug.