Level 5 and higher buildings can be converted into Barracks. But Farms haven’t been able to be converted to other buildings in a long time (although they can now become Advanced Farms).
So it seems very likely that you converted a level 5 Farm to a Barracks back in 2018, which you have just now converted back.