Hey KoW! I've found the cause of this. BTW, this is absolutely present in all versions of DFU, just the
change you requested back in February to lower the secondary inside flags when exiting buildings has helped reveal it to you.
Banks and Libraries are not considered shops by the
IsShop() test. They are considered to be service providers more like Temples and Taverns. The purpose of IsShop() test is to determine if quality message (e.g. "this shop is better appointed than many") should be displayed - which does not happen for Banks and Libraries.
If I was to change this, the player would start seeing quality messages for Banks and Libraries, which is not the intent of the IsShop() test. Insofar as classic, it displays the quality message for Libraries but not for Banks. I've just standardised this message to classify shops as buildings where the buy/sell inventory UI is used, which doesn't include these two building types.
To offer a solution, you can use the public property
PlayerEnterExit.BuildingType to get current building type player is inside of (if they are inside a building) and
PlayerActivate.IsBuildingOpen(buildingType) to determine if building is within opening hours. And of course, you should be using
PlayerEnterExit.IsPlayerInsideBuilding to determine if player is actually inside a building first.
To answer the second question, Town4 and Town23 are just houses and will be marked with the basic house colour on automap. These building types are not used directly in any quest, it's unknown why they have their own data type.