I have been there, done that. In fact, I still do unpaid work just to learn tools and stuff. Earlier when I started designing, I quit my software engineering work to 'learn design' in a start-up. Of course, it was underpaid even by fresher standards. But I knowingly took the gig to learn what design is about, the roles and responsibilities, the workflow, where to look for resources, it was basically discovering something new day by day.
Even now I do unpaid logo designs, posters, setting up websites, design workflows, UX consultancy, etc., The person who asks for the work cares about getting it done with very less fee or for free and I too care about getting something out of that work but if it is not money, it could be learning a new tool, even a known tool but as a revisit, to refresh the fundamentals, it could be a new business flow, it could be a new networking connection with which you could land a new client.
It all depends on how you measure it. If we measure in terms of money, yes it is unpaid or underpaid obviously but in terms of getting better at our skill and self-growth, it is hidden, obscure from our measurements.
For example, when I started designing, I was asked to create multiple GIFs and I did not know what tool to use, how to do it and there was no one to help. The first GIF, a simple one, took me reading 5 articles, switching between 4 tools, 3 days and numerous tutorials to make but I got the opportunity to test all the workflows, to try out multiple tools and finally discover an optimal process for myself. And the rest of the GIFs were done more quickly, multiple GIFs in a day.
I could have just walked back to my old company to continue my software engineer role. But I looked at the underpaid role as an opportunity even though it is an unfamiliar job and had to be done from scratch.
For me doing from scratch is the best way to learn anything because you do not just learn it but while doing so you will discover why it is being done. And that for me is the best paycheck. And sharing something will always increase one's knowledge and never decrease it.
So, it all depends on how you look at it. If you are doing it with consciousness and have a balance between money and self-growth, it is a win-win situation, you are good to go. Just measure the hidden quantities against the money involved, then accept the work if it balances out in your favour, decline otherwise.
And not just unpaid roles, have clarity in why you do what you do, you will never be exploited in any role. If you think you are being exploited, don't do it for free.