You found the bbb (batch beginner bug), but not the variable is empty, it's the expansion that doesn't work as expected.
Percent expansion is done when a line or a complete parenthesis block is parsed, before the code will be executed.
But to solve this you can use the delayed expansion</strong>, this doesn't expand at parse time, it expands just at execution time.
if exist "%_REALPATH%\tomcat-%TOMCAT_VER2%" (
) else if exist "%TOMCAT_VER2%" (