I'm going to assume you're considering salaried employees only, since it would be illegal in most places to even think about doing something like this with hourly employees. You get paid for the hours you work, period.
When you're a salaried employee, there will be some non-zero amount of work to do outside of traditional working hours. It can come from a variety of sources, and honestly, the sources are much less important than the motivations. Ask yourself the following questions:
Are the extra hours a result of something you did or didn't do?
- If you're often doing work after hours for something you didn't get done during the time assigned or expected, you may have too heavy of a workload or a workload not suited for your skill set. Get in touch with your manager to work this problem out before it interferes with deliverables.
Are the extra hours a result of a missed or approaching deadline?
- Welcome to professional development. Deadlines get missed, and projects always take longer than you expect, even when you take into account that they take longer than you expect. You can avoid this on some, even a lot of projects, but not all. And some just can't be late. Maybe it's the biggest account of the firm. Maybe it's a project for the CEO or an investor demo. Some things you just can't miss, and you have to burn the midnight oil. If these are a regular occurrence, you need to talk to your manager about increasing staffing or hiring a business manager to work with your clients to prioritize and defer workloads.
Are the extra hours a result of a misunderstanding of your regular duties?
- In an ideal situation, you should be able to perform all aspects of your work with no outside hours. There will always be a non-zero amount of overhead when it comes to working in any environment, whether it's as trivial as bathroom or coffee breaks, or as time consuming as training hours. And there will be a certain amount of time you'll spend setting up a development environment. There should be some guidelines about how long this takes. For instance, at my work we have a senior developer who has a handy folder with all the install files you need to get up and running, and you can do it in under an hour. If you spent all day doing this, you would be expected to explain why something took 5 or 10 times as long as anticipated. Note, this wouldn't be perfect. You might be missing some keybinds here and there in your IDE. You might be missing some project-specific files. But you'd be at least partially productive.
To wrap things up here, I don't think you necessarily should be asked to do that on your own time, but I do find the example of being a few days to get it set up perfect a little misleading. Yes, it would, but you wouldn't constantly be setting up your development environment for 3 days. Even if I started with a blank machine, I would probably be able to be committing code by the end of the first day, and I would be doing other things (filling out new hire paperwork, insurance, next of kin, etc) while the installs were running.