I worked for a company that got acquired by a larger company and one of the main things they acquired was the tech I had built. I recall one day when several of us were standing around -- me, my boss, the CEO of the big company that acquired us, and another top executive. The CEO remarked to the other executive that my boss had "built the tech" that they were so happy about. Of course I had coded every line of it, but that's not the way business works -- the guy who makes things happen on the business side is the person who gets the credit, and that is as it should be. Think of bosses as programmers of people.
I've worked in two small companies and people get attribution for what they did. It is so much simpler to know who is involved, and nicer, too. You can reach the right people when needed.
The time someone takes credit for my work and refuses to fix this, I run. I can, there are so many nice places one can work at, especially with the raise of remote work which I happen to like.
I would not expect my bosses to take my credit. And I do recognize their involvement too. Actually, we edit a public open source project and publish extensions for it, and individual contributors are listed as authors, instead of just the company name.
You have to look at things at the right level of abstraction.
Bosses "program" people, they set them to work on things that need doing. They can be more or less involved in the actual process, but ultimately they're responsible for delivering the thing.
Developers write all the code. Some may feel that they built the whole thing (I have been that person) but that neglects the role others play in figuring out what needs building and actually making it happen.
Edit: I don't believe it's right for others to take credit for someone else's work. I just think that when an executive hears a boss "built" something, they don't think "wow, what an amazing coder". They don't think about code at all. This person delivered a thing that was built. They built it in the organization. That's all it means.