Many teams are measured on the velocity numbers. There are scrum masters who forces the team to "achieve" the numbers without understating the science behind it. Sometime such people even ask team to put numbers against the "research and learning " work which the team has to do. And because of this velocity focus sometime they don't allow the team to learn or invest the time to reduce the technical debt.
Velocity is only a forecast - that x amount of work can be done. This might change. I usually take an average of sprints to get this value so any change in one Sprint doesn't impact much. Overall the pluses and minuses balances themselves out. But I do keep track of changes like people resigning, long vacation, long sick leaves , holiday season , new product /domain or technology , new members joining team. Such events will impact the velocity (and sometimes the story points) . Based on the change sometime I will ask my team to revisit the story points or even re estimate the story points and velocity.
The objective of the Sprint is to work on the item(s) which product owner thinks can get maximum ROI. Learning something new which you need in upcoming sprints or working on the technical debt is like investing for future Sprints. In that future sprint your team will be able to work more efficiently because of this small investment you made many sprints ahead. Some of my teams had reserved their 10% capacity every Sprint to learn something new or to reduce the technical debts. The teams who followed this rule became better than other teams I had. But spend this time judiciously. Always ask the product owner. It is their job to get the max ROI from Sprint so if learning something new or reducing the tech debts can be the ideal thing to do in one Sprint and some other time working on the next item in the backlog.
If your company is only focused on getting the high velocity numbers then there is big need of cultural change. You have to go slow to go fast.
Velocity is only a number which can be manipulated. To look good team can easily game the system, an in many occasion have seen them finishing all the work much ahead of the time. Finishing early is good but of it happens regularly then there is a problem. It could be a problem with the team or with the company which is putting pressure to meet the commitment without any failure. In this case maybe the team was trying to look good by taking less work. They will go into defensive mode which is not good. As long as the delivery is transparent its fine to not meet the commitment once in awhile. This shows that the team is pushing the boundaries to achieve more. But keep out an eye for team who never meets their commitment. There might be a problem.
My only advice is not to hung up on velocity numbers. They are only a forecast.