To me, it doesn't matter whether A is still open or not.
It doesn't matter if B came to me moments after A used my work on the same day.
In fact, I run into this all the time.
It depends.
Ideas are not copyrighted. Ideas are a dime-a-dozen. Variations on a theme are stock-in-trade. There are trends to follow and that become fashionable—you ignore this at your risk.
I have "stock" samples in my portfolio that I suggest for economy jobs to get more bang for my client's buck. Non-exclusive use is part of the agreement.
Similar is not the same.
If someone wants something similar to something I've designed, I'll design something similar for them, no problem. I'm pleased to do it.
And there are times that I will go to great lengths to "mimic."
Suppose that existing presentation artwork must be updated and the original is unavailable and the artist who put together the presentation is not available, either. In that case, I will match the style of the original presentation, perfectly as I can, so as not to "jar" the sensibilities of the audience, distracting them from the content with an inconsistency.
It this case, I would simply charge for the custom work I perform.
I have learned to charge and bill for "creative" separately from "production." That might help as there is design—the verb, and the noun. Just because the creative is done, does not mean that I never charge for it, again if I re-use it. I resell "stock art" every time I use it.
Let's talk about the files, in my possession. If I develop a template, I'm going to exploit it for what I can, for as long as I can, as many times as I can, with as few variations as is possible for maximum return on my investment—or, I go out of business and go to work for someone else doing it for them. I do run a business, after all.
I will also review past jobs to see what work I can salvage to save time and development expense. "Boilerplate" is the term for piecemeal substitute of design elements. Stock art is something I've both created for sale and purchased from others.
I sub-contract work for colleagues. I must copy their style and direction - exactly.
A contractor can't tear down a whole house to start over when an addition is requested. Matching the existing design isn't unusual.
But, the term "Knock off" suggests something else to me.
Suppose A has established a positive image, and an association with an identifiable "look." B wises to take advantage of the goodwill established by A by "passing itself off" as A. This is also known as infringement, legally, and can be actionable in court.
This is a Special Case. No. I'll try to talk them out of it in favour of a more ethical solution. I will warn them of the possibility, as well. I want their business, though.
It depends on intent.
Suppose, through some quirk of fate, you find that some of your work is used in a parody of the company/person in question. A parody is meant to mis-represent as part of the communication design.
Suppose you stumble upon a graphical solution to something that becomes a part of the pop culture like the "chef" printed in red on every pizza box by Wenk, or the smiley face by Ball. Do you refuse to use such icons? Exactly where do you draw (or plot) the line (or 2pt. rule)?
"The devil is in the details."
SHAMELESS PLUG: Do Good -D-e-s-i-g-n-, by David B. Berman, FGDC, R.G.D. (AIGA) How designers can change the world. Various cases are discussed to help you clear your mind about some ethical issues.