Lipiec jest miesiącem roku could mean both , but Lipiec jest miesiącem w roku means July is a month of the year , and with your sentence , ( 1 ) Ten miesiąc jest lipcem or ( 2 ) Ten miesiąc to lipiec ( better ) or eventually ( 3 ) Ten miesiąc nazywa się lipiec ( That month is named "Lipiec" )
You can say 'Lipiec jest tym miesiącem' - 'July is the/this month'.
In Polish you dont really have to worry about a/the. Distinction between those two usually comes with context. Without context both are correct (in majority of cases).
I would say, it's because 'roku' is genitive case, and genitive case is used for possession, hence, 'of'. 'July is a month [that belongs to] the year' = 'July is a month of the year'.