No, that isn't all they need to do but think about it. If your costs have gone up, but you somehow end up with record profit margins then the ONLY way you got there was by raising your prices enough to cover those costs. If you have record profits AND profit margins you had to not only jack prices enough to cover your increased costs but also enough to cover any reduced sales volume. The math just doesn't work any other way.
Also, companies are always greedy, but it is usually tempered by the realities of overreach. For example, sure, a company could increase prices by 1000% across the board on all their products tomorrow but they would likely lose their entire customer base. So instead, most companies increase prices every year or two by smaller percentages and fight to control costs as if their existence depends on it (which it often does).
What happened in 2020 provided cover for companies to jack prices WAY more than customers would normally tolerate. Inflation started as a legit byproduct of reduced supplies worldwide but the unique nature of the source (a once every 100-year pandemic) allowed companies to essentially price gouge legally (and many did) putting inflation into overdrive.
Even if you ran a company that didn't want to, if a supplier of yours jacked prices on a key component you had to follow suit unless you were going to eat the difference. Get a couple of companies doing that in a single chain and prices really begin to take off as it feeds each level above them until it reaches the consumer.