Competing magnetic energy scales in the topological flat-band ferrimagnet TbMn6Sn6