Sometimes when reading through user comments on a particular answer, some usernames that appear like
user12345 are not links. Is this a known behaviour or any other thing I am not aware of?
There are several cases where the username isn't a link to the user profiles.
The screenshots below are from questions and answers, but it works exactly the same way in comments except that there isn't any gray profile picture in comments.
The first case is the one you mentioned:
This happens when the user's account was deleted. This can happen if the user does bad enough things that a moderator decides to delete the account, or if it's a sock puppet account that doesn't follow the rules, or if the user requests to delete their own account, etc.
The second case has a user name but no clickable link and no reputation or badges:
This happens in one of two cases:
When a post gets migrated but the question author, answerers, and commenters don't have an account on the new site. The names displayed in this case is the users' actual usernames on the site where they have accounts.
On accounts deleted prior to about 2011, the username would not be changed to their user code before deletion. The deletion procedure was changed at about that time, but previous deletions weren't affected.
The third case has "anon" as user name:
This happens when the post has been dissociated from the user by their request. The original user may remain active on the site or be deleted later.
There is also a fourth case, where there is no username at all:
This only happens in review audits. Most of the time, it happens when the review audit is on a very good post posted by a very high-reputation user. To ensure that the audit is not completely obvious, the username and reputation are hidden.
Note that this is only shown sometimes; other times, a real user is shown, but their username is normalized and the wrong reputation score is shown (but it links to the real author's profile). This is to prevent people from using the above icon to identify audits.
In the vast majority of cases, the above reasons are correct. You may encounter some posts where the above reasons don't apply (e.g. a post where there is no username at all, when you're not looking at a review), but those are very rare edge cases. If you want to know what's going on in a specific case, make a post on the per-site meta of the site you see it on.
Username like you mentioned which don't have links are the user which are deleted/abandoned from particular SE sites which might have varied reasons.
Below blog post explain it clearly,